How to download a file using command prompt (cmd) Windows?



If you’re like most Internet users, you download various types of files now and then. You either download these files with your web browser or some download manager software. Have you ever considered downloading files using the command prompt i.e. CMD? If not, we recommend you to try it. It’s quite interesting apart from being very useful as well. In this article, we’ll show you how to download a file using command prompt aka CMD.

How to download a file using command prompt?

  There are several useful commands for the Command Prompt and one of them is bitsadmin. Though bitsadmin has several uses, here we shall limit this article to its role in downloading files only. If you want to read the details about bitsadmin syntax, continue reading this section. Otherwise, you can scroll down to the next section – Downloading a file.
  The syntax of bitsadmin is :
BITSADMIN [/RAWRETURN] [/WRAP | /NOWRAP] command
  As you know, the parts of the syntax inside the square brackets are OPTIONAL. So, we use them only if we need them. In this case, we don’t need to bother ourselves with [/RAWRETURN], [WRAP] and [/NOWRAP]. So, we need to type bitsadmin, followed by the command whose syntax (in this case) is :
/TRANSFER <job name> [type] [/PRIORITY priority] [/ACLFLAGS flags] remote_url local_name
The various parts of this syntax have been explained below :
  • /TRANSFER – We use this command for transferring files. You can use it to upload/download files. Multiple files may be uploaded/downloaded at a time.
  • <job name> – We need to provide a name for the transfer job which we are going to perform.
  • [type] – This part is OPTIONAL. You may use it to specify whether the transfer job is going to upload or download file(s). The default action is download.
  • [/PRIORITY priority] – This part is also OPTIONAL. However, we recommend that you use it. You may use it to set the priority of the job as LOW, NORMAL or HIGH. For best performance, set it to HIGH.
  • [/ACLFLAGS aclflags] – This is also OPTIONAL.
  • remote_url – The URL of the file you want to download. Please note that the URL must have the file’s name at the end, otherwise the job will not start.
  • local_name – The location of your computer where you want to download the file. It should end in the name of a file, and the file name should be the same as the one at the end of the remote_url.
Example –
bitsadmin /transfer wcb /priority high http://example.com/examplefile.pdf C:\downloads\examplefile.pdf
In the above example, wcb is the name we assigned to the transfer job,http://example.com/examplefile.pdf is the URL of the file to be downloaded andC:\downloads\examplefile.pdf is the location where the file would be saved after being downloaded.

Downloading a file

  You can download a file using the following syntax :
bitsadmin /transfer TransferJobName /priority high UrlOfTheFile SaveFileAsName
You need to replace TransferJobName with a word (which could be anything), UrlOfTheFile with the URL of the url of the file to be downloaded and SaveFileAsName with the complete location where the file would be downloaded and saved.
For example, we downloaded a PDF file (1.04 MB) named sample.pdf from website – http://www.africau.edu/images/default/sample.pdf. We used the following command for downloading this file –
bitsadmin /transfer wcb /priority high http://www.africau.edu/images/default/sample.pdf D:\sample.pdf
The results are displayed in the following screenshots :

How to download a file using Command Prompt – Downloading

How to download a file using Command Prompt – Download Finished
  Downloading file(s) using the Command Prompt is a great idea if you’re looking to do some COOL things. It is also useful if you don’t want to use third party programs for downloading files. You can download multiple files using this method. However, it has one drawback. Downloading files using Command Prompt is a slow process. It is slower than a typical file downloader program. So, if speed is important for you, don’t use this method.
  We hope you enjoyed this article. Let your friends and colleagues know how to download a file using Command Prompt by SHARING THIS ARTICLE…

Comments

Post a Comment

Popular posts from this blog

Angular 9 - User Registration and Login Example & Tutorial

How to Include ThreeJs in Your Projects