Solved bat file dont move files with space in their name! :-(

May 17, 2012 at 03:09:12
Specs: Windows 7
bat file dont move files with space in their name! it works fine with those which dont have a space, but fails with an error "The syntax of the command is not correct" in the cases of files having a space in their names

See More: bat file dont move files with space in their name! :-(

Report •

#1
May 17, 2012 at 07:24:07
Have you set the variable, that contains the filename to be moved, in double quotes?

Report •

#2
May 17, 2012 at 09:18:37
Thanks for your help, but I am sorry, I didn't understand your suggestion
the command-line was
for %%f in ("*.pdf*") do move %%f "C:\...\My Folder"
this was moving all the .pdf files in the current directory that had no space in b/w their names, but was returning the error when there was a space in between...

Report •

#3
May 17, 2012 at 09:36:16
✔ Best Answer
This should help:

for %%f in ("*.pdf*") do move "%%f" "C:\...\My Folder"


Report •

Related Solutions

#4
May 17, 2012 at 09:42:01
Thanks man for your help!!
it worked out perfectly!!

Report •

Ask Question