2

I am very new to cmd prompt and I was asked to find out how to script cmd to pull files from a website.

Honestly, I am totally at a loss, so any help would help me escalate the project I am working on.

Currently, I am using this script to go to the website but, but I am probably making some kind of mistake. I am on Windows 7.

@echo Off
TITLE Download Treasury Files
Pause
CD C:\Users\wkhan\desktop
START http://www.treasury.gov/ofac/downloads/t11sdn.pdf
1
1

I think there is no built in tool in Windows that would do that for you. But there are plenty free programs on the web, that you can install and then call from your batch script. Here is one of them: CURL

Here is a basic example of how to use it (using your link)

@echo Off
TITLE Download Treasury Files
Pause
CD C:\Users\wkhan\desktop
curl http://www.treasury.gov/ofac/downloads/t11sdn.pdf > download.pdf

This would download and save the file from the URL you have provided to download.pdf

Another possible alternative would be WGET.

UPDATE:

From Windows 10 build 17063 and later, ‘Curl’ is now included, so that you can execute it directly from Cmd.exe or PowerShell.exe

source: https://superuser.com/a/1584434/281154

3
  • 1
    when I try to install CURL this is the error msg: "the program cant start because libssl32.dll is missing from your computer. try reinstalling the program to fix this problem. – Vaz May 12 '14 at 14:37
  • I got that same error with wget and it used to work. It must be something with the environment settings... – David Brossard Dec 21 '15 at 22:54
  • 1
    As suggested here, curl seems to be preinstalled now - yay!' – Janaka Bandara Jan 18 at 2:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.