0

im using the batch script below and i keep getting the error "/ was unexpected at this time."

any ideas?

thanks

@ 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
  • 2
    It could be a good idea to remove the spaces between '/' and your options. Better use 'find /n ...' and also at 'for /f'. Also avoid spaces when using 'set var=...' – jeb Nov 15 '12 at 14:14

1 Answers1

3

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
Ken White
  • 123,280
  • 14
  • 225
  • 444