Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Still learning how to use BitsAdmin.exe in batch files. Here is my script, which fails to finish downloading a file, and leaves just a temp file called "BIT851.tmp" on my desktop. Any idea what I am doing wrong?

echo off
SETLOCAL ENABLEDELAYEDEXPANSION
::------------------------------------------
::
:: Requires BitsAdmin.exe from Windows Resource kit
:: Download name: WindowsXP-KB838079-SupportTools-ENU.exe
::
::------------------------------------------
bitsadmin.exe /reset

bitsadmin.exe /create myDownloadJob

bitsadmin.exe /addfile myDownloadJob^
 http://mirror.anl.gov/pub/ubuntu-iso/DVDs/ubuntu/8.04/release/FOOTER.html^
 "%USERPROFILE%"\Desktop\FOOTER.html

bitsadmin.exe /resume myDownloadJob
::bitsadmin.exe /list myDownloadJob
::bitsadmin.exe /info myDownloadJob

TYPE "%USERPROFILE%"\Desktop\FOOTER.html
pause
share|improve this question

1 Answer 1

when the status of the job is transferred use bitsadmin /complete to make the file available. Note that bitsadmin has been depricated and you should be using powershell instead.

share|improve this answer
    
I'm not surprised it is deprecated since I can't get it to work. If I use the '/complete' option the script strangely goes into a infinite loop and never materializes the actual file. I've been coding batch files for years and never have seen anything like it. –  djangofan Dec 9 '11 at 22:25
    
I'm not sure this script will work just looking at the commands, but the lack of /complete will certainly ensure it never completes. –  Jim B Dec 9 '11 at 22:28
    
I need more of an answer than just what the help documents imply. I included my script in my question so that someone who is familiar with bitsadmin can help me. –  djangofan Dec 12 '11 at 23:42
    
If you want to know what's wrong with your script you should ask that, instead you asked why the temp file is left there. I answered that question. –  Jim B Dec 13 '11 at 1:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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