Monday, August 5, 2019

Batch Script using Powershell to download from the web

Being that most of my work is done remotely, I have a batch script which downloads all my tools from my FTP server to the client's PC. I just copy and paste the text into notepad on the client's PC and save it as a batch and run it.



This works great, but the problem is, the programs I use get updated every so often - so I would be downloading old versions.
By doing a little research, I found that PowerShell can download files directly from the web.



Download a file via HTTP from a script in Windows



How to execute powershell commands from a batch file?




It seems that all the pieces are there, but I don't know anything about PowerShell at all and I'm a total amateur with batch. Further, i guess you cant just call up PowerShell in the batch script and start writing in PowerShell.



So here is the end goal;
To write a batch script which uses powershell to download files from different websites (i would provide URLs). Instead of downloading the files from my FTP server, the script would download the programs right from the source.



Thank you so much in advance.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...