How to handle spaces in dir. name?

March 30, 2009 at 01:43:05
Specs: Windows XP
Hi all

I have ran in to some minor problem in my bat file. If I try to move a file into a directory that contain spaces in the name e.g Dir A the file will not move into that directory.

If I rename the directory name to DirA then the files will move there.

From the help I got from my other postings in this topic

for /f "tokens=* delims= " %%a in ('dir/b CIS_A_*.pdf') do (move %%a C:\Dir A)

And so to the question, is it possible to contain the space in the directory name or do I have to rename all the directories containing spaces in the name of the directory ?


See More: How to handle spaces in dir. name?

Report •


#1
March 30, 2009 at 02:14:41
put quotes around it "%%a" "Dir A"

now i am wondering which one is faster:
for /f "tokens=* delims= " %%a in ('dir/b CIS_A_*.pdf') do
for /f "tokens=*" %%a in ('dir/b CIS_A_*.pdf') do
for /f "delims=" %%a in ('dir/b CIS_A_*.pdf') do


Report •
Related Solutions


Ask Question