PDA

View Full Version : problem passing arguments to a batch file



Martin_SBT
02-05-2004, 01:57 PM
Hi

I am having hard time figuring out how to do the following thing. I have a batch file that i am firing from AMS5 and need to pass 4 arguments to the batch file. Lets say i got the following variables:


exePath = "C:\\test\\test.exe"
arg1 = "PC1";
arg2 = "PC2";
arg3 = "account";

and my batch file is called "toto.bat".

batch file content is: %1 %2 %3 %4 (simple isnt it!)
From AMS, i need to fire up toto.bat passing it the 4 arguments (variables) showed above so it give something like:

C:\test\test.exe "PC1" "PC2" account

(note that arg1 and arg2 must be passed quoted)


I tried to use the file run action and pass the 4 arguments within the action but i am always getting compile error!! then i tried concatenating the 4 args into a single string to be passed as a single arg to my batch but....no luck...

i know i am missing something here, i would appreciate if any of you could help me out with that!

thanks in advance

Mt

Lorne
02-05-2004, 02:20 PM
If you need to quote the args, you might have to include escaped quotes in the string: e.g. "\"PC1\""

Worm
02-05-2004, 02:27 PM
Or you might write the batch file out from AMS so that you needn't worry about sending it command lines.

Martin_SBT
02-06-2004, 06:15 AM
thanks gents

i will go the Worm's way!:lol :lol :lol