We help IT Professionals succeed at work.

Windows 10 Automation : how to download files automatically

HIROYUKI TAMURA
on
I would like to download files on windows 10.
I have 10 specific paths and need to download one by one automatically
Comment
Watch Question

Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
You may do this automation with many programming/scripting languages. I would do it with AutoHotkey. If you're not familiar with that scripting language, my EE article will get you going on it:

AutoHotkey - Getting Started

After you've installed AutoHotkey, create this script with Notepad or whatever text editor you prefer (but make the file type AHK, not TXT):

FileURL1:="https://autohotkey.com/download/1.1/version.txt"
FileLocal1:=A_Temp . "\AHKversion.txt"
ErrorCode:=Download(FileURL1,FileLocal1)
If (ErrorCode!=0)
  MsgBox,4144,Failure,Error=%ErrorCode% trying to download:`n%FileURL1%
Else
  MsgBox,4160,Success,Downloaded: %FileURL1%`nInto: %FileLocal1%
ExitApp

Download(URL,File)
{
  UrlDownloadToFile,%URL%,%File%
  Return %ErrorLevel%
}

Open in new window

That's a sample for you, but it is also a working script. Run it...it will work...check the file that it downloaded...should be a one-line text file that looks like this:

1.1.32.00

Of course, you'll change the FileURL1 and FileLocal1 assignment statements in the script to have the URL for your file and the location on your PC where you want it downloaded. Then (after line 7 and before the ExitApp statement) you'll add nine more sets of similar statements for the other nine files. Regards, Joe
Distinguished Expert 2019

Commented:
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
Are you looking for a script in vbscript or powershell by chance?  Is this a one time thing for the 10 files?
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Hiroyuki,

I enhanced the script that I posted above and wrote an EE article about it:
Automatically download files from the web - AutoHotkey Script

As you can see from the Title, the enhanced version is also written in the AutoHotkey language, so you may still need my EE article on it:
AutoHotkey - Getting Started

If you have any questions about the new script, you may post them here or at the article. Regards, Joe
Distinguished Expert 2019

Commented:

Hi  HIROYUKI TAMURA.

I wonder if my suggestion was even looked at, since you provided no feedback at all. It should be the simplest way to do it.

See: 

To the right, there's my file (c:\Users\Hagen\Desktop\new 1) with links. The simple syntax (yes, one line)

wget.exe -i "C:\Users\Hagen\Desktop\new 1"

takes those links and downloads them to the current directory.


Or did you try it but found it hard to setup wget (I could understand that)?

Just in case, here's how you do it:

open powershell as administrator and paste the following, first:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

then

choco install wget

As powershell will then tell you:

The install of wget was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\Wget\tools'