sending parameters to a batch file

Aug 10, 2013 at 8:20pm
ok so im trying to send the parameters "app" "version" and "file" to my batch file that will copy file from the app/version folder on the network, but i cant seem to pass the prams correctly can some one help me

i tried this
system("xfer.bat app version file");
but i just end up opening the batch file and passing the words app version and file not the values collected before hand
Last edited on Aug 10, 2013 at 8:22pm
Aug 10, 2013 at 9:15pm
What are the values collected beforehand stored in?
Aug 10, 2013 at 9:50pm
looks like you're missing the point of the system() function.
this function sends a c-string to the creating process to be evaluated.

try this instead:


1
2
3
std::string s;
s = std::string("xfer.bat ") + app + std::string(" ") + version + std::string(" ") + file;
system( s.c_str() );


this method assumes that app, version and file are string objects.
Aug 10, 2013 at 11:31pm
ok ill try that and the app version and file are just local variable strings
Aug 11, 2013 at 1:25am
that worked perfect thanks!
Topic archived. No new replies allowed.