Click here to Skip to main content
15,664,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using WinSCP to connect to my ftp server. I get files from ftp server and saved them in a local folder on my pc. I have a batch script that I run manually everyday. This script synchronizes the files in the ftp server with those in my local folder, this script ensures that any changes made to the files in the ftp server are also updated in the local folder.

NB: the ftp credentials listed are for example purpose but is similar format with my actual credential:

This is my script/batch file:

WinSCP.exe /console ftp://ftpusers01:Control_10234@172.12.500.32 synchronize local "C:\Users\KulluteweE\Documents\FTP Files" /Documents/Goarge

I have generated a report in Power BI that uses data from one of the files in the local folder. The script needs to run daily so that the report has current up to date data.

The problem I have is that I cant run the script myself every day. I need to automate the script. I have tried using task scheduler but that did not work for me. The script can not run when my pc is off/ logged out and it cant ran when I am not connected to the network.

how can I run the script/batch file automatically even when my pc is off and I am not connected to the internet. Or if this is impossible what other alternatives do I have? Please feel free to share some ideas.

What I have tried:

I have tried windows Task scheduler. It didn't work.
Updated 10-Jun-22 5:35am

1 solution

You can't.
The key bit here is "How can I run a batch file when the pc is off"
When a PC is powered down, the processor is not running, and no applications, scriopts, or batch files can execute on it.

If it's hibernated, or sleeping then it's possible to wake it on a timer: How to Make Your PC Wake From Sleep Automatically[^] but then you'd probably need to run your batch file as a service as no user is probably logged in when your batch file ran.

And if it's not connected to a network, then you can't access any other machine via FTP either ...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900