Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS ? recursive dirs with spaces in the name 1

Status
Not open for further replies.

hovercraft

Technical User
Jun 19, 2006
236
US
Sorry, I don't know where else to look for help on this.

I'm trying to use a bat file to copy a file into several directories and all of their sub directories. It works great until it hits a directory with a space in the name then it goes on to the next directory.

Any idea how I could change this line to consider spaces?

Code:
for /R %toptarget% %%i in (.) do (
copy %myfile% %%i
)

Thanks for your help!
Dave
 
Put double-quotes around the path, for example:
copy "%myfile%" "%%i
 
Thanks Guitarzan, you're the guitar man!

I've read through billions of posts and couldn't find the answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top