Batch command download Web page

Source: Internet
Author: User

BITSAdmin Examples

The following examples show how to use the BITSAdmin tool to perform the most common tasks. For a complete list of switches and description of their use, see BITSAdmin Tool

Transfer a File

The /transfer switch is a shortcut for performing the tasks listed below. This switch creates the job, adds the "files to the" job, activates the job in the transfer queue, and completes the job. BITSAdmin continues to show progress information in the MS-DOS window until the transfer completes or an error occurs.

Bitsadmin/transfer mydownloadjob/download/priority Normal Http://downloadsrv/10mb.zip C:\10mb.zip
Create a Download Job

Use the /create switch to create a download job named Mydownloadjob.

Bitsadmin/create Mydownloadjob

BITSAdmin returns a GUID that uniquely identifies the job. Use the GUID or job name in subsequent calls. The following text is sample output.

Created Job {C775D194-090F-431F-B5FB-8334D00D1CB6}.

 

Next, use the /addfile switch to add one or more files to the download job.

Add Files to the Download Job

Use the /addfile switch to add a file to the job. Repeat this call for each file, want to add. If multiple jobs use Mydownloadjob as their name, you must replace mydownloadjob with the job's GUID to uniquely identify The job.

Bitsadmin/addfile mydownloadjob http://files.cnblogs.com/files/gayhub/bcn.js C:\bcn.bat

o Activate the job in the transfer queue, use the /resume switch.

Sets the priority of the specified job.

Syntax

Bitsadmin/setpriority <Job> <Priority>

 

Parameters
Parameter Description

Job

The job ' s display name or GUID

priority

One of the following values:

  • foreground

  • high

  • normal

  • low

He following example sets the priority for the job named Mydownloadjob to normal.

C:\>bitsadmin/setpriority Mydownloadjob FOREGROUND

  

Activate the Download Job

When you create a new job, BITS suspends the job. To activate the job in the transfer queue, use the /resume switch. If multiple jobs use Mydownloadjob as their name, you must replace mydownloadjob with the job's GUID to uniquely identify The job.

Bitsadmin/resume Mydownloadjob

O Determine the progress of the job, use the /list, /info, or /monitor switch.

Determine the Progress of the Download Job

Use the /info switch to determine the progress of a job. If multiple jobs use Mydownloadjob as their name, you must replace mydownloadjob with the job's GUID to uniquely identify The job.

Bitsadmin/info Mydownloadjob/verbose

 

The /info switch returns the state of the job and the number of files and bytes transferred. When the state was transferred, BITS had successfully transferred all files in the job. The /verbose argument provides complete details of the job. The following text is sample output.

GUID: {482fcaf0-74bf-469b-8929-5ccd028c9499} DISPLAY:myDownloadJobTYPE:DOWNLOAD state:transient_error Owner:domain \userpriority:normal files:0/1 bytes:0/unknowncreation time:12/17/2002 1:21:17 PM modification time:12/17/2002 1: 21:30 pmcompletion time:unknownnotify interface:unregistered NOTIFICATION flags:3retry delay:600 NO PROGRESS TIMEOUT: 1209600 ERROR count:0proxy usage:preconfig proxy list:null proxy BYPASS list:nullerror FILE:    HTTP://DOWNLOADSRV/10 Mb.zip-C:\10mb.zipERROR CODE:    0x80072ee7-the server name or address could not being resolvederror context:0x0000 0005-the error occurred while the remote file is being processed. Description:job FILES:        0/unknown working http://downloadsrv/10mb.zip, C:\10mb.zipNOTIFICATION COMMAND line: None

To receive information for all jobs in the transfer queue, use the /list or /monitor switch.

need some delay times

Delay 4s

Ping-n 4 127.0.0.1>nul

  

Completing the Download Job

The state of the job is transferred, BITS have successfully transferred all files in the job. However, the files is not available until you use the/complete switch. If multiple jobs use Mydownloadjob as their name, you must replace mydownloadjob with the job's GUID to uniquely identify The job.

Bitsadmin/complete Mydownloadjob
Monitoring Jobs in the Transfer Queue

Use the /list, /monitor, or /info switch to monitor jobs in the transfer queue. The /list switch provides information for all jobs in the queue.

Bitsadmin/list

The /list switch returns the state of the job and the number of files and bytes transferred for all jobs in the T Ransfer queue. The following text is sample output.

{6AF46E48-41D3-453F-B7AF-A694BBC823F7} job1 SUSPENDED 0/0 0/0{482fcaf0-74bf-469b-8929-5ccd028c9499} job2 TRANSIENT_ ERROR 0/1 0/unknownlisted 2 job (s).

Use the /monitor switch to monitor all jobs in the queue. The /monitor switch refreshes the data every 5 seconds. To stop the refresh, enter Ctrl + C.

Bitsadmin/monitor

The /monitor switch returns the state of the job and the number of files and bytes transferred for all jobs in th E transfer queue. The following text is sample output.

Monitoring BACKGROUND COPY MANAGER (5 second refresh) {6af46e48-41d3-453f-b7af-a694bbc823f7} job1 SUSPENDED 0/0 0/0{482f caf0-74bf-469b-8929-5ccd028c9499} job2 transient_error 0/1 0/unknown{0b138008-304b-4264-b021-fd04455588ff} job3 Transferred 1/1 100379370/100379370
Deleting Jobs from the Transfer Queue

Use the /reset switch to remove all jobs from the transfer queue.

Bitsadmin/reset

The following text is sample output.

{DC61A20C-44AB-4768-B175-8000D02545B9} canceled. {Bb6e91f3-6eda-4bb4-9e01-5c5cbb5411f8} Canceled.2 out of 2 jobs canceled.

Reference Documentation:

1.https://msdn.microsoft.com/en-us/library/aa362812 (v=vs.85). aspx

2.https://technet.microsoft.com/zh-cn/library/cc771868 (v=ws.10). aspx

  

  

  

 

  

  

 

Batch command download Web page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.