Post a reply :: Support Forum

Username
Subject
Message body
Options

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.


(max 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)
Options
 

Topic review

Author Message
martin
See also:
https://winscp.net/eng/docs/guide_debugging_scheduler
mvneema
Post
martin wrote:
mvneema wrote:
In the windows "BackUp" task scheduler Action tab: I have the action as start a program and Program to be
"C:\Program Files\WinSCP\WinSCP.exe"/command"/script=C:\myScript\testScript.txt". This is what I have been trying.

The /command can be removed. It does not do anything if not followed by any command. Also try to add /log=path_to_log and inspect the log (or attach it here).

"C:\Program Files\WinSCP\WinSCP.exe" /script=C:\myScript\testScript.txt /log="path_to_log"


It finally worked. I gave the following
Action: Start a program
Program/script: path to your batch script e.g. C:\Users\beruk\bodo.bat
Add arguments (optional): nothing
Start in (optional): Put the full path to your batch script location e.g. C:\Users\beruk\
Then Click OK. It worked.

Thanks for the help everyone.
martin
Post
mvneema wrote:
In the windows "BackUp" task scheduler Action tab: I have the action as start a program and Program to be
"C:\Program Files\WinSCP\WinSCP.exe"/command"/script=C:\myScript\testScript.txt". This is what I have been trying.

The /command can be removed. It does not do anything if not followed by any command. Also try to add /log=path_to_log and inspect the log (or attach it here).

"C:\Program Files\WinSCP\WinSCP.exe" /script=C:\myScript\testScript.txt /log="path_to_log"
JimBobDelicate
Post
mvneema wrote:
Clydesdale Jim wrote:
Hmm, I use a batch file that calls winscp in console mode then asks it to reference the .txt as a script. Is that what you are doing here?


In the windows "BackUp" task scheduler Action tab: I have the action as start a program and Program to be
"C:\Program Files\WinSCP\WinSCP.exe"/command"/script=C:\myScript\testScript.txt". This is what I have been trying.


What would happen if you changed {command"} to console. If that doesnt work you could also try putting that content in to a batch file and try running that from the task scheduler. If you encounter permission errors I would suggest creating a shortcut to the batch file that runs with admin permissions and have the task scheduler run that. I hope some of that helps you get this working Smile
mvneema
Post
Clydesdale Jim wrote:
Hmm, I use a batch file that calls winscp in console mode then asks it to reference the .txt as a script. Is that what you are doing here?


In the windows "BackUp" task scheduler Action tab: I have the action as start a program and Program to be
"C:\Program Files\WinSCP\WinSCP.exe"/command"/script=C:\myScript\testScript.txt". This is what I have been trying.
Clydesdale Jim
Post
Hmm, I use a batch file that calls winscp in console mode then asks it to reference the .txt as a script. Is that what you are doing here?
mvneema
Post
JimBobDelicate wrote:
Hmm,

what does the batch file look like?

Here is an example of what my batch looks like that calls my text file to pass to Winscp
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /log="C:\example\Log Files\!S!M!D!Y!T.log" /Script=Mywinscp.txt

I should also note that when using task scheduler to automate a file transfer with a locally mapped network drive you may want to throw in a line that opens the directory as well or you will see error code 3. Also make sure you are running the automater with highest permissions. Does this help?


The script file (testScript.txt) has the set of commands that downloads the file to network drive. I tried the same thing you just said but I get 0x1 error code as the result. I have attached a snapshot of the history of the task been executed. I am not sure of where am i going wrong.
JimBobDelicate
Post
Hmm,

what does the batch file look like?

Here is an example of what my batch looks like that calls my text file to pass to Winscp
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /log="C:\example\Log Files\!S!M!D!Y!T.log" /Script=Mywinscp.txt

I should also note that when using task scheduler to automate a file transfer with a locally mapped network drive you may want to throw in a line that opens the directory as well or you will see error code 3. Also make sure you are running the automater with highest permissions. Does this help?
mvneema
Post
JimBobDelicate wrote:
Can you provide the code please and I can help troubleshoot this. Are you trying to pass console commands to Winscp ? why not open in console mode as part of your script. What type of script?


hi, i just posted as guest since i didn't log in (by mistake) but that was my response.I am not able to delete it either.sorry for the confusion.
to make it more clear:

thanks for the response. Yes I am trying to pass console commands to winscp. the script is as follows:
option batch on
option confirm off
open ftp://user:password@ftp.example.com
cd /home/user
get example.pdf Y:\
exit

I saved this script into a text file called "testScript.txt" in my C:\myScripts. And my winSCP.exe is present in C:\Program Files\WinSCP.

while creating the task, i gave the following:
In the action tab:
Program/script:
(I browse to the winSCP executable file which is "C:\Program Files\WinSCP\WinSCP.exe"
Add arguments(optional): /command "/script =C:\myScripts\testScript.txt"

I clicked finish button and the task ran with code 0x1 and did not give me an error. Can you help me on this??
Guest
Post
hi,
thanks for the response. Yes I am trying to pass console commands to winscp. the script is as follows:
option batch on
option confirm off
open ftp://user:password@ftp.example.com
cd /home/user
get example.pdf Y:\
exit

I saved this script into a text file called "testScript.txt" in my C:\myScripts. And my winSCP.exe is present in C:\Program Files\WinSCP.

while creating the task, i gave the following:
In the action tab:
Program/script:
(I browse to the winSCP executable file which is "C:\Program Files\WinSCP\WinSCP.exe"
Add arguments(optional): /command "/script =C:\myScripts\testScript.txt"

I clicked finish button and the task ran with code 0x1 and did not give me an error. Can you help me on this??
JimBobDelicate
Post
Can you provide the code please and I can help troubleshoot this. Are you trying to pass console commands to Winscp ? why not open in console mode as part of your script. What type of script?
mvneema
Hi,

I am have been trying for past 2 days to transfer the files from ftp server to my local directory. When I tried using the winscp command prompt it worked the file was transfered but when I try automating by creating the task. It gives me the error as
"Task Scheduler failed to launch action "winscp" in instance "{e0b53590-b2d6-4380-bd56-9ce2e4d35a08}" of task "\Backup". Additional Data: Error Value: 2147942402."

Can anyone please help me since I a very new in writing the script also working in winSCP???

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License