put the find command in a batch file -


the following command works fine in cmd window. lists directories contains word "note" not "notes".

dir c:\myfiles\mydirectories /s /b /ad |find "note" | find "notes" /v

when put command in batch file, cmd complains invalid switch -v.

dir c:\myfiles\mydirectories /s /b /ad ^|find "note" ^|find "notes" /v

what did wrong? thanks.

this on windows 7.

are you:

1) escaping pipes when put in batch file command ? if yes, don't escape pipes.

dir c:\myfiles\mydirectories /s /b /ad |find "note" |find "notes" /v 

2) having search invokes within sub-shell ? if yes, retain escape characters on pipes. mean like:

for /f "delims=" %%a in ('dir c:\myfiles\mydirectories /s /b /ad ^|find "note" ^|find "notes" /v') echo 

3) having command saved in batch file invoked in sub-shell ? if yes, discard escape characters. mean:

for /f "delims=" %%a in ('call <path batch file containing command>') echo 

4) if none of above, error showing when line part of larger batch file ? if yes, can please share entirely ?


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -