如果我这样做:
IF EXIST "%DRVL%:\Windows\syswow64" (SET "arch=x64") ELSE (SET "arch=x86")
IF "%arch%"=="x86" DO (
ECHO x86
)
IF "%arch%"=="x64" DO (
ECHO x64
)
比显示它:
x86
'DO is not recognized as an internal or external command,
operable program or batch file.
x64
我做错了什么?
答案 0 :(得分:1)
IF
不需要DO
(FOR
)。
试试这个:
IF EXIST "%DRVL%:\Windows\syswow64" (SET "arch=x64") ELSE (SET "arch=x86")
IF "%arch%"=="x86" (
ECHO x86
)
IF "%arch%"=="x64" (
ECHO x64
)
格式略有不同,以展示嵌套IF
条件:
IF EXIST "%DRVL%:\Windows\syswow64" (
SET "arch=x64"
) ELSE (
SET "arch=x86"
)
IF "%arch%"=="x86" (
ECHO x86
) ELSE (
IF "%arch%"=="x64" ECHO x64
)