IF和其他Windows脚本

时间:2013-05-27 17:18:37

标签: windows if-statement scripting

以下是我的代码,但它不断给我error: else was unexpected at this time

@echo on
:Install_Language
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0409"
    IF %ERRORLEVEL% == 0 (
        Echo English
        ) else (
    reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "040c"
    IF %ERRORLEVEL% == 0 (
        Echo French 1
        )
    )   else (
            reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0C0C"
        IF %ERRORLEVEL% == 0 (
        Echo French2
        )
    )   

1 个答案:

答案 0 :(得分:0)

据我所知,其中只有一个是真的,所以这应该有用。

@echo on
:Install_Language
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0409" > nul && Echo English
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "040c" > nul && Echo French 1
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0C0C" > nul && Echo French2