I am writing a simple batch file and i get this "The syntax of the command is incorrect" error for the if statement.The batch file is as below:
@echo off
set ARCH=%PROCESSOR_ARCHITECTURE%
if %ARCH% == 'x86'
(
)
I also tried
if %ARCH% EQU 'x86'
What is wrong with the if statement?
try
@echo off
set ARCH=%PROCESSOR_ARCHITECTURE%
if %ARCH% == x86 ( echo ok )
rem or %ARCH% EQU x86
and while you are at it, why not learn vbscript as well, here's the equivalent
Set WshShell = WScript.CreateObject("WScript.Shell")
Set Wsharch = WshShell.Environment("SYSTEM")
arch=Wsharch.Item("PROCESSOR_ARCHITECTURE")
If arch = "x86" Then
WScript.Echo "PROCESSOR_ARCHITECTURE is x86"
End If
' if Instr(arch,"86") > 0 then
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With