Task Scheduler/Scripting Basics Help

Advertisement

spaldingl
Joined:
Posts:
2

Task Scheduler/Scripting Basics Help

Hello, I'm very new to scripting. The underlying principles I understand, it's just the syntax I need some help on. All I need to do is create a task in the Task Scheduler that reuploads the same file from my computer to my Linux server every 30 minutes, essentially just overwriting it. I was reading over this article https://winscp.net/eng/docs/guide_schedule#win10 but got confused when it started talking about the arguments. Could someone tell me what exactly I need to type in the add arguments box in order to get it to upload the file to linux? I downloaded a script from WinSCP that I believe should accomplish this, just need to know how to translate that into the Scheduler arguments.

Script:
open sftp://ec2-user@ec2-servernumbers.compute-1.amazonaws.com/ -hostkey="hostkey=" -privatekey="C:\Users\privatekeypath" -passphrase="password" -rawsettings Cipher="aes,chacha20,3des,WARN,des,blowfish,arcfour" ConsiderDST=0

lcd "C:\Users\filepath\"
cd /usr/java/linuxpath/

put index.jsp

pause
exit

Reply with quote

Advertisement

fairudyn
Joined:
Posts:
6
Location:
Singapore

Hi I believe you would save your script as a .txt file. Then you will need to create a batch script to trigger your .txt file.

For example the script you listed you saved it as upload index.txt

THen you will need to create a .bat file from a notepad and save it as upload index.bat

On your task scheduler under the Actions Tab
Select Start a Program
And browse to your .bat script

You can leave Add arguments and Start in blank

Reply with quote

spaldingl
Joined:
Posts:
2

fairudyn wrote:

Hi I believe you would save your script as a .txt file. Then you will need to create a batch script to trigger your .txt file.

For example the script you listed you saved it as upload index.txt

THen you will need to create a .bat file from a notepad and save it as upload index.bat

On your task scheduler under the Actions Tab
Select Start a Program
And browse to your .bat script

You can leave Add arguments and Start in blank


That is what I was planning on doing, but the windows machine doesn't recognize the commands like cd or open that the unix machine does, so I'm not sure how to fix that in my script.

Reply with quote

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

Yes, you can save the commands to .txt.

But the point is that you then specify WinSCP.exe as the program to execute in the scheduler. As the article says:
* Browse for WinSCP.exe executable.
And use arguments like /script=C:\path\to\script.txt /log=C:\path\to\script.log /ini=nul

Or you can use the /command and specify the commands directly on WinSCP command-line. But that may not be convenient, providing the small box in the scheduler.

Reply with quote

Advertisement

You can post new topics in this forum