Passing paramaters

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Passing paramaters

Post by Bob Hansen » Sun Apr 03, 2005 9:07 pm

Working with a compiled script with some passed in variables.
The following line works good directly from the command line:
C:\Path\CompiledScript.exe /Value1=string /Value2=1
----------------------------------------------
When called from a batch file, however, /Value1 and /Value2 are not passed.
C:\Path\Batchfile.bat /Value1=string /Value2=1

Batch file contents:
C:\Path\CompiledScript.exe %1 %2
----------------------------------------------
So I modified the batch file and the values /Value1 and /Value2 are passed. with this format
C:\Path\Batchfile.bat string 1

Batch file contents:
C:\Path\CompiledScript.exe /Value1=%1 Value2=%2
----------------------------------------------
I would really prefer to use the format of the first batch file that allows me to see the variable name with their values:
C:\Path\Batchfile.bat /Value1=string /Value2=1
but don't see why it is rejected.

Can anyone please provide an explanation?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 04, 2005 7:38 am

As far as I am aware .bat files don't support /parmname=parmvalue and only expect each value referring to them as %1, %2 etc. That's just the way it is. Macro Scheduler works differently and expects /name=value pairs.
MJT Net Support
[email protected]

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Mon Apr 04, 2005 11:41 am

Write the batch file like this:

Batch file contents:
C:\Path\CompiledScript.exe %1=%2 %3=%4


Then call it like you are used to:
C:\Path\Batchfile.bat /Value1=string /Value2=1

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 04, 2005 3:07 pm

Thanks adroege.

That looks like it may work, will try that tonight. Looking at the syntax it would seem that the command line is using "=" as a delimiter. I think I did try sending /Value1==string, but that did not work either. Will let you know the results.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts