- Download files from the web
- Find files you’ve downloaded on your PC
- Change the default download folder on your PC
- Why some files won’t open in Internet Explorer
- About download and security warnings
- Download a file via HTTP from a script in Windows
- 8 Answers 8
- Download a file from HTTPS using download.file()
- 9 Answers 9
- Windows batch file file download from a URL
- 20 Answers 20
- Downloading files in PURE BATCH. Without any JScript, VBScript, Powershell, etc. Only pure Batch!
- How to download a file from a URL in C#?
- 11 Answers 11
Download files from the web
The new browser recommended by Microsoft is here
Get speed, security, and privacy with the new Microsoft Edge .
There are several types of files you can download from the web—documents, pictures, videos, apps, extensions and toolbars for your browser, among others. When you select a file to download, Internet Explorer will ask what you want to do with the file. Here are some things you can do, depending on the type of file you’re downloading:
Open the file to view it, but don’t save it to your PC.
Save the file on your PC in the default download location. After Internet Explorer runs a security scan and finishes downloading the file, you can choose to open the file, the folder it’s stored in, or view it in Download Manager.
Save as a different file name, type, or download location on your PC.
Run the app, extension, or other file type. After Internet Explorer runs a security scan, the file will open and run on your PC.
Cancel the download and go back to browsing the web.
You can also save smaller files—like single pictures—to your PC. Right-select the picture, link, or file you want to save, and then choose Save picture or Save target as.
Find files you’ve downloaded on your PC
Download Manager keeps track of pictures, documents, and other files you download from the web. Files you’ve downloaded are automatically saved in the Downloads folder. This folder is usually located on the drive where Windows is installed (for example, C:\users\your name\downloads). You can always move downloads from the Downloads folder to other places on your PC.
To view files you’ve downloaded while using Internet Explorer, open Internet Explorer, select the Tools button, and then select View downloads. You’ll be able to see what you’ve downloaded from the web, where these items are stored on your PC, and choose actions to take on your downloads.
Change the default download folder on your PC
Open Internet Explorer, select the Tools button, and then select View downloads.
In the View Downloads dialog box, select Options in the lower-left.
Choose a different default download location by selecting Browse and then selecting OK when you’re done.
Why some files won’t open in Internet Explorer
Internet Explorer uses add-ons such as Adobe Reader to view some files in the browser. If a file that needs an add-on won’t open, you might have an older version of the add-on, which needs to be updated.
About download and security warnings
When you download a file, Internet Explorer checks for clues that the download is malicious or potentially harmful to your PC. If Internet Explorer identifies a download as suspicious, you’ll be notified so you can decide whether or not to save, run, or open the file. Not all files you’re warned about are malicious, but it’s important to make sure you trust the site you’re downloading from, and that you really want to download the file.
If you see a security warning that tells you the publisher of this program couldn’t be verified, this means that Internet Explorer doesn’t recognize the site or organization asking you to download the file. Make sure you recognize and trust the publisher before you save or open the download.
There are always risks to downloading files from the web. Here are some precautions you can take to help protect your PC when you download files:
Install and use an antivirus program.
Only download files from sites that you trust.
If the file has a digital signature, make sure that the signature is valid and the file is from a trusted location. To see the digital signature, select the publisher link in the security warning dialog box that opens when you first download the file.
Download a file via HTTP from a script in Windows
I want a way to download a file via HTTP given its URL (similar to how wget works). I have seen the answers to this question, but I have two changes to the requirements:
- I would like it to run on Windows 7 or later (though if it works on Windows XP, that’s a bonus).
- I need to be able to do this on a stock machine with nothing but the script, which should be text that could be easily entered on a keyboard or copy/pasted.
- The shorter, the better.
So, essentially, I would like a .cmd (batch) script, VBScript, or PowerShell script that can accomplish the download. It could use COM or invoke Internet Explorer, but it needs to run without any input, and should behave well when invoked without a display (such as through a Telnet session).
8 Answers 8
If you have PowerShell >= 3.0, you can use Invoke-WebRequest :
Background Intelligent Transfer Service (BITS) is a component of modern Microsoft Windows operating systems that facilitates prioritized, throttled, and asynchronous transfer of files between machines using idle network bandwidth.
Starting with Windows 7, Microsoft advises to use the PowerShell cmdlets for BITS.
You could also use BITS via COM Objects, see here for an example VBScript. And there is bitsadmin , a Command line tool to control downloads:
BITSAdmin is a command-line tool that you can use to create download or upload jobs and monitor their progress.
In Windows 7 bitsadmin.exe states itself that it is a deprecated tool. Nevertheless:
Try the System.Net.WebClient class. There is a sample PowerShell script at the bottom of this page:
Copy and paste the following six lines (or just the last four lines) into a text file. Then rename it to vget.vbs .
Obviously you need to customize three things in this script to make it work for you.
- The part which says http://www.exampleURL.com/FILE.TXT . You will need to substitute the correct URL for the file you wish to download.
- The command you will run at the command line to execute this script; will need to specify the correct name for the script, vget.vbs , if that is what you called it.
- And the name FILE.TXT that you want the output to be directed to by a DOS batch command line.
I have only tried using this to download a raw ASCII text file (a more powerful CMD script) from my Dropbox account, so I don’t know if it will work for EXE files, etc.; or from other Web servers.
Download a file from HTTPS using download.file()
I would like to read online data to R using download.file() as shown below.
Someone suggested to me that I add the line setInternet2(TRUE) , but it still doesn’t work.
The error I get is:
Appreciate your help.
9 Answers 9
It might be easiest to try the RCurl package. Install the package and try the following:
Here’s an update as of Nov 2014. I find that setting method=’curl’ did the trick for me (while method=’auto’ , does not).
I’ve succeed with the following code:
Note that I’ve changed the protocol from https to http, since the first one doesn’t seem to be supported in R.
If using RCurl you get an SSL error on the GetURL() function then set these options before GetURL(). This will set the CurlSSL settings globally.
The extended code:
Worked for me on Windows 7 64-bit using R3.1.0!
127 means command not found
In your case, curl command was not found. Therefore it means, curl was not found.
You need to install/reinstall CURL. That’s all. Get latest version for your OS from http://curl.haxx.se/download.html
Close RStudio before installation.
Offering the curl package as an alternative that I found to be reliable when extracting large files from an online database. In a recent project, I had to download 120 files from an online database and found it to half the transfer times and to be much more reliable than download.file.
In this case, rough timing on your URL showed no consistent difference in transfer times. In my application, using curl_download in a script to select and download 120 files from a website decreased my transfer times from 2000 seconds per file to 1000 seconds and increased the reliability from 50% to 2 failures in 120 files. The script is posted in my answer to a question I asked earlier, see .
Try following with heavy files
Had exactly the same problem as UseR (original question), I’m also using windows 7. I tried all proposed solutions and they didn’t work.
I resolved the problem doing as follows:
Using RStudio instead of R console.
Actualising the version of R (from 3.1.0 to 3.1.1) so that the library RCurl runs OK on it. (I’m using now R3.1.1 32bit although my system is 64bit).
I typed the URL address as https (secure connection) and with / instead of backslashes \\ .
Setting method = «auto» .
It works for me now. You should see the message:
Windows batch file file download from a URL
I am trying to download a file from a website (ex. http://www.example.com/package.zip) using a Windows batch file. I am getting an error code when I write the function below:
The batch file doesn’t seem to like the «/» after the http. Are there any ways to escape those characters so it doesn’t assume they are function parameters?
20 Answers 20
With PowerShell 2.0 (Windows 7 preinstalled) you can use:
Starting with PowerShell 3.0 (Windows 8 preinstalled) you can use Invoke-WebRequest :
From a batch file they are called:
(PowerShell 2.0 is available for installation on XP, 3.0 for Windows 7)
There’s a standard Windows component which can achieve what you’re trying to do: BITS. It has been included in Windows since XP and 2000 SP3.
The job name is simply the display name for the download job — set it to something that describes what you’re doing.
This might be a little off topic, but you can pretty easily download a file using Powershell. Powershell comes with modern versions of Windows so you don’t have to install any extra stuff on the computer. I learned how to do it by reading this page:
Last I checked, there isn’t a command line command to connect to a URL from the MS command line. Try wget for Windows:
http://gnuwin32.sourceforge.net/packages/wget.htm
In Linux, you can use «wget».
Alternatively, you can try VBScript. They are like command line programs, but they are scripts interpreted by the wscript.exe scripts host. Here is an example of downloading a file using VBS:
https://serverfault.com/questions/29707/download-file-from-vbscript
Downloading files in PURE BATCH. Without any JScript, VBScript, Powershell, etc. Only pure Batch!
Some people are saying it’s not possible of downloading files with a batch script without using any JScript or VBScript, etc. But they are definitely wrong!
Here is a simple method that seems to work pretty well for downloading files in your batch scripts. It should be working on almost any file’s URL. It is even possible to use a proxy server if you need it.
For downloading files, we can use BITSADMIN.EXE from the Windows system. There is no need for downloading/installing anything or using any JScript or VBScript, etc. Bitsadmin.exe is present on most Windows versions, probably from XP to Windows 10.
USAGE:
You can use the BITSADMIN command directly, like this:
bitsadmin /transfer mydownloadjob /download /priority FOREGROUND «http://example.com/File.zip» «C:\Downloads\File.zip»
Proxy Server:
For connecting using a proxy, use this command before downloading.
bitsadmin /setproxysettings mydownloadjob OVERRIDE «proxy-server.com:8080»
Click this LINK if you want more info about BITSadmin.exe
TROUBLESHOOTING:
If you get this error: «Unable to connect to BITS — 0x80070422»
Make sure the windows service «Background Intelligent Transfer Service (BITS)» is enabled and try again. (It should be enabled by default.)
CUSTOM FUNCTIONS
Call :DOWNLOAD_FILE «URL»
Call :DOWNLOAD_PROXY_ON «SERVER:PORT»
Call :DOWNLOAD_PROXY_OFF
I made these 3 functions for simplifying the bitsadmin commands. It’s easier to use and remember. It can be particularly useful if you are using it multiple times in your scripts.
PLEASE NOTE.
Before using these functions, you will first need to copy them from CUSTOM_FUNCTIONS.CMD to the end of your script. There is also a complete example: DOWNLOAD-EXAMPLE.CMD
:DOWNLOAD_FILE «URL»
The main function, will download files from URL.
:DOWNLOAD_PROXY_ON «SERVER:PORT»
(Optional) You can use this function if you need to use a proxy server.
Calling the :DOWNLOAD_PROXY_OFF function will disable the proxy server.
How to download a file from a URL in C#?
What is a simple way of downloading a file from a URL path?
11 Answers 11
Include this namespace
Download Asynchronously and put a ProgressBar to show the status of the download within the UI Thread Itself
Complete class to download a file while printing status to console.
Usage:
Also you can use DownloadFileAsync method in WebClient class. It downloads to a local file the resource with the specified URI. Also this method does not block the calling thread.
For more information:
Check for a network connection using GetIsNetworkAvailable() to avoid creating empty files when not connected to a network.
Below code contain logic for download file with original name
As per my research I found that WebClient.DownloadFileAsync is the best way to download file. It is available in System.Net namespace and it supports .net core as well.
Here is the sample code to download the file.
With above code file will be downloaded inside tepdownload folder of the project’s directory. Please read comment in code to understand what above code do.