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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help using Put to call a batch file

Status
Not open for further replies.

spidermerc

IS-IT--Management
Apr 7, 2004
5
US
I am trying to call a batch file from an output card and I want to pass 2 parameters to it.
Something like -CMD ...test.bat arg1 arg2

But I can't use CMD in the "rules" box for dynamic parameters. I am trying to use a Put for this.

something like this:

=PUT ("BATCH", -CMD,"test.bat " + arg1 + " " + arg2)

Any thoughts on what I am doing wrong here?

thanks!
 
The rule should be like this

=PUT ("BAT", "-CMD ""test.bat " + arg1 + " " + arg2,"")

I'm not sure if it's 1 or 3 " after test.bat.
The last parameter is for any data that is to be passed to the batch process.
Jan
 
I got it to complete the map successfully, but it still does not run the batch file. I made the batch file simple, copy a file from one place to another. Not sure where to go from here.

=PUT ("BAT", "-CMD H:\Mercinfiles\gary\decrypt_cash_test.bat " + dateoffile items:parseFileName + " " + cycle items:parseFileName, "")

Thanks for any help, I guess I need to figure out how to see where it is "failing".
 
Try the double "" infront of the batch file name.
=PUT ("BAT", "-CMD ""H:\Mercinfiles\gary\decrypt_cash_test.bat " + dateoffile items:parseFileName + " " + cycle items:parseFileName, "")

This is one I use that works fine

=valid(put("BAT","-cmd ""ftpcmd.bat " + OKItem Items:.:eek:kfile + " workfiles\" + ftpset + "ftpdets.txt" + " "+ ftpset + "FTPlog.txt"" -tv -I"," "),fail("run ftp failed " + TEXT ( LASTERRORCODE ( ) ) + " " + LASTERRORMSG()))
 
Looks like it was a rights issue for the command adapter - or something like that. Thanks for your help. spider
 
Also, it would not work until I used the double quotes like you said.

Here is what I learned from this:

Typetree item is a text "blob" and set the output card to a file and create a batchresult.txt to see the results of the batch file as it runs.

This batch file takes 2 params.

=get("BAT","-cmd ""decrypt_cash.bat " + text(dateoffile items:parseFileName) + " " + text(cycle items:parseFileName))

Using the get instead of the put allows the results of the batch file to be written to a file - so you can check the results using a FIND or whatever.

like this:

=if (FIND("1 file(s) copied",get("BAT","-cmd MyBatch.bat"),1 )=0,
Fail("Batch Failed"),
"ok")

thanks to all, hope this helps someone else
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top