Batch file 将/i开关与在for循环中运行的if命令结合使用时出错
我得到以下错误:Batch file 将/i开关与在for循环中运行的if命令结合使用时出错,batch-file,Batch File,我得到以下错误: The following usage of the path operator in batch-parameter substitution is invalid: %~xI"==".URL" (start /B "%%I" "%PROGNAME%\Internet Expl orer\iexplore.exe" "%%I") For valid formats type CALL /? or FOR /? The syntax of the command is in
The following usage of the path operator in batch-parameter
substitution is invalid: %~xI"==".URL" (start /B "%%I" "%PROGNAME%\Internet Expl
orer\iexplore.exe" "%%I")
For valid formats type CALL /? or FOR /?
The syntax of the command is incorrect.
我的代码是:
for %%I in (%CD%\Startup\*) do IF /i "%~xI"==".URL" (start /B "%%I" "%PROGNAME%\Internet Explorer\iexplore.exe" "%%I") ELSE (start /B "%%I" "%%I")
我正在尝试将.url文件与其他扩展名放在同一目录中,并对url文件运行一个命令,对其他文件运行一个单独的命令,以强制url文件在单独的浏览器窗口中打开。如果很难看到,
“%~xI”
应该是“%~xI”
如果恩多的回答能解决你的问题,请接受它。
for %%I in ("%CD%\Startup\*") do IF /i "%%~xI"==".URL" (start /B "%%~I" "%PROGNAME%\Internet Explorer\iexplore.exe" "%%~I") ELSE (start /B "%%~I" "%%~I")