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
slhck
  • 235,242
Vaz
  • 33
  • 1
  • 1
  • 3

1 Answers1

2

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

Art Gertner
  • 7,429