Call a bat from a bat with parameters

April 9, 2013 at 04:31:36
Specs: Windows 7
main.bat contains:
cscript treat.vbs /a:"the name of file"

REm: the name of file contains many spaces

treat.vbs contains:
dim param: param_input=Wscript.Arguments.Named("a")
msgbox param_input "second.bat" param_input & " " & ""myfile.out""

second.bat contains:(just for purpose of test)
echo %1
echo %2

When running the main.bat, msgbox shows a popup with all the name file (including all spaces contained within the name of file, while the echo message echo %1 shows the name of file cutting down.

How can I do to workaround that, please?

See More: Call a bat from a bat with parameters

Report •

April 9, 2013 at 08:01:19
To disable output to the screen put @echo off at the top of the batch file.

Example here:

Report •

April 9, 2013 at 08:13:34 "second.bat" param_input & " " & ""myfile.out""
You need to be careful when simplifying and making your code generic. Otherwise, someone like me is liable to point out this line is invalid and wouldn't run. "second.bat """ & param_input & """ ""myfile.out"""

How To Ask Questions The Smart Way

Report •

April 11, 2013 at 10:21:12
Try the start /b command or the cmd command in a .cmd or a .bat file if you are looking to run the program within the current program in command prompt.

Report •
Related Solutions

Ask Question