Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing batch script 1

Status
Not open for further replies.

jackforceus

Programmer
Apr 4, 2003
9
0
0
US
I've a rule to execute a batch script. Please let me know if there's a problem in it.
=PUT("BAT","-CMD C:\Mercator6.5\scripts\printClaim.bat -TRACE C:\Mercator6.5\scripts\batchTrace.txt","printClaim.bat")

It doesn't work
 
I think you need double quotes round your command parmeters in parameter 2.
=PUT("BAT","-CMD ""C:\Mercator6.5\scripts\printClaim.bat -TRACE C:\Mercator6.5\scripts\batchTrace.txt""","printClaim.bat")
 
I'm sure this is the syntax for PUT function
/* PUT (adapter_alias, adapter_commands, data_to_send_to_adapter) */
so there will be only 3 parameters.If I include the double quotes as you said, I'll end up in having 4.
Anyhow I tried as you said which is an invalid rule
Thanks
 
If you're trying to get the result of the batchfile, you should be using a GET, not a PUT.

Even if you do not want the result a GET is better thsan a PUT if there are no options to pass:

(note, you do not need the -CMD part at all if the command is a batch file without parameters)

=GET("BAT","C:\Mercator6.5\scripts\printClaim.bat -T C:\Mercator6.5\scripts\batchTrace.txt")

Hope this helps.
 
Sorry the double quotes should only have been round the parameters for the -cmd
=PUT("BAT","-CMD ""C:\Mercator6.5\scripts\printClaim.bat"" -TRACE C:\Mercator6.5\scripts\batchTrace.txt","printClaim.bat")
 
What if I would like to use a batch script as both a target and a source adapter (that is, use a batch script in a request/response way)?

GET seems not to work with the following arguments:
GET( "BAT", "-TRACE -INLINE -FILE -CMD script.bat", TEXT( In_Number ) )

The batch gets invoked with the following syntax:
script.bat %data% tmp\tmp0000.tmp

I would have liked "%data%" to be the value of In_Number.

Any idea how to provide input data to a batch script and to get its output back?
 
Re-write your GET:

=GET("BAT","script.bat "+TEXT(In_Number))

The script will be called with the contents of In_Number as the first argument, and the script can use %1 to pick up this argument.

The rule cell will be populated with any output from the script.

I.E. if script.cmd is:

@echo #%1#

...and the input was 12, the output will be:

#12#

Hope this helps

Paul Brett (MCC)
Enterprise Support Analyst
Customer Care UK
Mercator®
 
I can't get the batch to work with the get or the put. I've tried all the syntax above, but it does not work. Did you actually try this?

=GET("BAT","script.bat "+TEXT(In_Number))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top