Computing.Net > Forums > Programming > How to handle spaces in dir. name?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to handle spaces in dir. name?

Reply to Message Icon

Name: newbee
Date: March 30, 2009 at 01:43:05 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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 ?



Sponsored Link
Ads by Google

Response Number 1
Name: reno
Date: March 30, 2009 at 02:14:41 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How to handle spaces in dir. name?

Replace space in folder names www.computing.net/answers/programming/replace-space-in-folder-names/16936.html

how to write trees in VB www.computing.net/answers/programming/how-to-write-trees-in-vb/12216.html

batch to count files in DIR then send email www.computing.net/answers/programming/batch-to-count-files-in-dir-then-send-email/19628.html