|
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
kpraap
Joined: 11 Dec 2007 Posts: 1 Country: Singapore |
|
Running a bat file |
|
Hi,
I have a batch file that uses WinSCP to FTP files from a remote UNIX server to a local drive. The file runs fine when run manually, but when I run it from 24x7, the job finishes in a second with a message in the Job Log "Process finished with exit code 1".
I have enabled the trace, below is the simple code where I am using RunAndWait function to run the batch file.
1: DIM
1: Executing DIM("RETN", "NUMBER")
2: RUNANDWAIT
2: Executing RUNANDWAIT("C:\Documents and Settings\kparulekar\My Documents\Backup\MfgPro\Country Databases\FTP\SFTP.bat", "", "0", "0")
Return "2060"
4: EXIT
4: Executing EXIT
Thanks
|
|
Fri Dec 14, 2007 5:29 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7847
|
|
|
|
The command line includes spaces in the file path. Please note that the first argument in the RunAndWait is the complete command line, not a file name, currently it attempts to find and launch C:\Documents passing the rest as command line parameters. You need to wrap the entire file name in double quotes, as you would do it when running the command manually
|
|
RunAndWait("\"C:\\Documents and Settings\\kparulekar\My Documents\\Backup\\MfgPro\\Country Databases\\FTP\\SFTP.bat\"", "", 0, ret) |
By the way, in such a simple job script, EXIT is not required at the end. Use EXIT if you want to abort a job somewhere in a middle of a long script. Also backslashes should be doubled. Please see "Special ASCII characters" topic in the on-line help for more info.
Another tip, if the job is simply designed to run a single batch process, it is much better to convert job type from script to a simple program type job. If you want a script, convert your batch file into job script using built-in FTP functions. This way you can get the complete error handling automatically added to the script. Shell any FTP operation fail within a job script (don't confuse with batch script outside 24x7), it will let you know which one and a specific error message will appear in the job log file.
|
|
Fri Dec 14, 2007 10:36 am |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|