Scheduling tasks with PowerShell
Doing the same thing over and over again is boring. Thanks to scripting, we can automate this kind of job and save a good amount of time (and patience). In this post, I’ll show you how to do this with PowerShell and Windows Task Scheduler.
First you’ll need a script, a set of commands that will do the job for you, in my case, I was trying to send some files from my job’s PC to my cellphone, I was doing this everyday and I used to get annoyed by the fact that I had to do it manually. So I decided to automate this task.
To do this, I searched cc sseraphined some ways to copy files with PowerShell, unfortunately, I had some problems with xcopy, so I moved to adb, which is a tool to interact with Android devices.
adb has this command to copy files:
adb push $source $dest
So I created a file named copy_with_adb.ps1 with the command above and saved it in some random folder.
Task Scheduler
Now here’s where the magic happens, we’ll use Windows Task Scheduler to run our script at especific conditions:
^ is in portuguese but you get it
And that was what I learned today.