Package: run the command with quotes in a loop with a pipeline to find

Could you please advise how to fix the command below which removes unversioned elements from svn

rem @echo off for /f "tokens=2*" %%i in ('"c:\Program Files\TortoiseSVN\bin\svn.exe" status --no-ignore ^| find "?"') do echo %%i 

option below without work path:

 rem @echo off for /f "tokens=2*" %%i in ('svn.exe status --no-ignore ^| find "?"') do echo %%i 

but I need to transfer all the way using svn.exe. In this case, the C: \ Program outputs are not a valid program.

+3
source share
2 answers

try the following:

  for /f "usebackq tokens=2*" %%i in (`"c:\Program Files\TortoiseSVN\bin\svn.exe" status --no-ignore ^| find "?"`) do echo %%i 
+2
source

When I ran into this problem, I tried using "usebackq" as suggested in the link to the Windows command [1]:

Indicates the execution of a back-quoted string as a command and a single-quoted string as a string of a string. In addition, it is allowed to insert file names in Set in quotation marks.

I found that this still gave an error stating that C: \ Program is not executable.

Then I remembered that Windows cmd.exe has really strange quoting rules, where if the first and last characters in the executable line are quotation marks, they will be deleted [2].

So I tried this and it worked for me:

 for /F usebackq %%d in (`""path to command" arg arg "quoted arg""`) do @echo %%d 

[1] http://technet.microsoft.com/en-us/library/cc754900.aspx

[2] http://technet.microsoft.com/en-us/library/cc771320.aspx

0
source

All Articles