我正在使用下面的批处理脚本,我不断收到错误“/此时是/意外。”
任何想法?
感谢
@ Echo off
set n_user =%%%% username password;
c:\windows\system32\find / n "%% n_user" C:\Users\Voyager\Desktop\server installs\OpenVPN\config\list.txt> result.txt
for / f "skip = 1"%% a in (result.txt) do set n =%% a
if "% s%" == "----------" exit 1
exit 0
答案 0 :(得分:3)
删除/
与/ n
中的切换字符(应为/n
)和/ f
(应为/f
)之间的空格。 (你还有其他几个空间问题。我也修复了它们。你还需要用双引号括起包含空格字符的路径名。)
@ Echo off
set n_use =%%%% username password;
c:\windows\system32\find /n "%%n_user" "C:\Users\Voyager\Desktop\server installs\OpenVPN\config\list.txt"> result.txt
for /f "skip=1" %%a in (result.txt) do set n=%%a
if "%s%" == "----------" exit 1
exit 0