|
Answer» Hi all, I have a master file which calls another batch file like below:
Call "C:\CmdDest\CopyFiles.cmd"
pause
The CopyFiles.cmd calls this: xcopy "C:\Users\images\*.*" "C:\Program Files\images" /y pause
xcopy "C:\Pics\*.*" "C:\Program Files\Pics" /y
pause
What I would like to do is INSTEAD of hard coding the C:\Users\SunGard Branding\images\*.*, C:\Program Files\images etc I would like to PASS these as Parameters from the Master file to the Child batch file...
Please help me...Have you tried:
Call "C:\CmdDest\Copyfiles.Cmd 'C:\Program Files\Images' 'C:\Program Files\Pics' "
Batch parameters are saved to the variable %1,2,3,4,5,6,7,8,9 and for more than 9 you need to use SHIFT depending on OS. (i.e. OS+Command Prompt or MS-DOS) and
xcopy "C:\Users\images\*.*" %1 /y pause
xcopy "C:\Pics\*.*" %2 /y pauseWhen I do this:
Call "C:\CmdDest\Copyfiles.Cmd 'C:\Program Files\Images' 'C:\Program Files\Pics' "
It SAYS the filename, directory name or volume lable syntax is incorrect
please helpCall "CopyFiles.CMD" Param1 Param2
CopyFiles.CMD echo %1, %2
Output: Param1
Looks like on my version it only passes the first variable Param1 to %1, don't know why it doesn't pass more than a single parameter.
Update: You Could pass a single string and have CopyFiles.CMD parse that into two variables after the fact with string manipulation but thats more of an advanced topic and I still haven't gotten all the kinks out short of trimming a known part of the string out using set str=%str:~4% to assuming the first four characters need to be trimmed out.Try: Call "C:\CmdDest\Copyfiles.Cmd" "C:\Program Files\Images" "C:\Program Files\Pics"
|