passing variable to a batch file
i am calling a batch file for xcopy. i have the path of the file to b copied in variable a. my code is:
dim shell,z
z="for.bat " & a & " " & b & " " & c
set shell=createobject("wscript.shell")
shell.Run z, 1, true
where for.bat is:
for %%f in (%1,%2,%3) do xcopy %%f D:\shipment\ /e
when 'a' has small path like D:\flexcube
, it works. but if i put some big path, say:
D:\flexcube1\开发者_StackOverflow社区New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder
it does not work. is their some length restriction on %1 type variables or is this some other problem? any help is really appreciated.space
is the problem. D:\flexcube1\New Folder\New Folder\
has space between New and Folder. You need to provide ""
around the path.
Try enclosing the directory name in quotes like this:
"D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder"
In your path (
D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder
) There are spaces between the word New
and the word Folder
. What I suggest you should do, is put quotes around it which will make it look like this:
"D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder"
精彩评论