Help

Advertisement

bounce
Joined:
Posts:
3
Location:
Australia

Help

Hi All,

im trying to run a batch file and automate it in task scheduler, if i run the batch file on its own it runs fine, as soon as i run it in task scheduler it fails to sendmail like in the batch file.

below is my batch file and script file.

****Batch File****
@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=c:\batch\getmyfile.txt

if errorlevel 1 goto error

echo Success
sendmail.exe -t < success_mail.txt
goto end

:error
echo Error!
sendmail.exe -t < error_mail.txt

:end

****Script File****

open ftp://###%40#####.com.au:#############H@######.com.au/

cd /
lcd C:\batch\getmyfile

get -delete getmyfile.txt

exit

# Execute the script using a command like:
# "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /script="C:\path\to\script\script.txt"

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
32,114
Location:
Prague, Czechia

Re: Help

Do you positively know that is problem with "sendmail"? Do you get any error message? Do you know if WinSCP succeeded?

Reply with quote

bounce
Joined:
Posts:
3
Location:
Australia

The batch file runs fine when double clicked on and sends email on failure or success on transfer, but when it’s ran in task scheduler it will still download the file but fails to run the error level checking in the batch file!! From reading different posts, in running task scheduler you should run it from as “winscp.exe” and call the script file, but how do you run error level checking running it that way??

Reply with quote

bounce
Joined:
Posts:
3
Location:
Australia

all fixed and got it to work, in task scheduler, under actions i selected the batch file and add the directory to "Start In" option and it worked!!

Reply with quote

Advertisement

You can post new topics in this forum