/此时是意外的-批处理脚本
问题描述:
我使用下面的批处理脚本,但我不断收到错误"/这一次是意外的."
im using the batch script below and i keep getting the error "/ was unexpected at this time."
有什么想法吗?
谢谢
@ 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
答
删除/
和/ n
(应为/n
)和/ f
(应为/f
)中的开关字符之间的空格. (您还有其他一些空格问题.我也已解决了这些问题.您还需要用双引号将包含空格字符的路径名括起来.)
Remove the spaces between /
and the switch character in / n
(should be /n
) and / f
(should be /f
). (You have a couple of other space issues, too. I've fixed them as well. You also need to surround pathnames containing space characters in double-quotes.)
@ 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