我需要测试是否设置了变量.我已经尝试了几种技术,但他们忽视了,只要%1用双引号包围时,如情况%1是"c:\some path with spaces".
IF NOT %1 GOTO MyLabel // This is invalid syntax
IF "%1" == "" GOTO MyLabel // Works unless %1 has double quotes which fatally kills bat execution
IF %1 == GOTO MyLabel // Gives an unexpected GOTO error.
Run Code Online (Sandbox Code Playgroud)
根据此站点,这些是受支持的IF语法类型.所以,我没有办法做到这一点.
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
Run Code Online (Sandbox Code Playgroud)