Sunday 15 August 2010

Spaces in FOR /F and RD loop in .BAT file using text file -



Spaces in FOR /F and RD loop in .BAT file using text file -

can help me solve unusual issue cmd trailing space lines. i've written simple batch script removing folder paths listed in file. command:

for /f "tokens=* delims=" %%p in (paths.txt) rd /s %%p

i've set test path name string path.txt:

\\sample path

unfortunately, when script runs splits contents of file 2 lines , treat separately \\sample , path. if utilize echo instead of rd reads whole lines regardless of spaces.

how forcefulness rd /s command ignore spaces? don't want utilize double quotes folder path in text file.

for /f "delims=" %%p in (paths.txt) rd /s "%%p"

place quotes in rd command enclosing retrieved path

batch-file for-loop cmd rd

No comments:

Post a Comment