Jump to content

bitsadmin.exe /transfer integrated into au3 script


Go to solution Solved by Kajoe,

Recommended Posts

Posted

I want to try to put a cmd line into autoit, but can't find the way to do it.

When I put the below line (Fill in Name and Site original Name I want and Site where to download from)  in a .cmd file and execute the .cmd in Autoit, than it downloads and renames the file perfectly. But I would like to put this line into au3 script and not in a cmd file. Is that possible? Can someone he

@echo off

bitsadmin.exe /transfer "Name" https://www.Site C:\downloads\setup.exe

Exit

I tried the below line, but it does not work:

RunWait(@ComSpec & " /c bitsadmin /transfer https://www.Site", "C:\downloads\setup.exe", @SW_Hide)

 

Best regards, Kajoe

 

Posted (edited)

It is probably a question of quotes not properly converted from AutoIt to the command line.  Use a consoleWrite before to test it.

Local $sCmd = 'something "something" something'
ConsoleWrite($sCmd & @CRLF)
RunWait($sCmd,...)

You can then see and copy the result of the console to test if it is still working with a command line statement.

ps.  Your RunWait is also highly suspicious.  Make sure you understand how to use it (see help file).  Your second parameter is certainly wrong.

BTW there is a BITS UDF somewhere in the forum.  I know because I helped actively to facilitate the creation of it...

Edited by Nine
  • Developers
Posted

You RunWait() is "totally" different from the batch command:
 

bitsadmin.exe /transfer "Name" https://www.Site C:\downloads\setup.exe
RunWait(@ComSpec & " /c bitsadmin /transfer https://www.Site"                                  , "C:\downloads\setup.exe", @SW_Hide) 

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
17 hours ago, Nine said:

It is probably a question of quotes not properly converted from AutoIt to the command line.  Use a consoleWrite before to test it.

Local $sCmd = 'something "something" something'
ConsoleWrite($sCmd & @CRLF)
RunWait($sCmd,...)

You can then see and copy the result of the console to test if it is still working with a command line statement.

ps.  Your RunWait is also highly suspicious.  Make sure you understand how to use it (see help file).  Your second parameter is certainly wrong.

BTW there is a BITS UDF somewhere in the forum.  I know because I helped actively to facilitate the creation of it...

I was not at home today. So I could answer earlier. I am going to give it a try.  So I have to write the CMD line exactly into Local $sCmd?

Posted
11 hours ago, Jos said:

You RunWait() is "totally" different from the batch command:
 

bitsadmin.exe /transfer "Name" https://www.Site C:\downloads\setup.exe
RunWait(@ComSpec & " /c bitsadmin /transfer https://www.Site"                                  , "C:\downloads\setup.exe", @SW_Hide)

 

Hi Jos, 

Yes it is because I am looking voor a solution to put it in autoit with RunWait. I do not konw how to put it in RunWait line in au3

  • Developers
Posted
2 hours ago, Kajoe said:

Yes it is because I am looking voor a solution to put it in autoit with RunWait

That doesn't make any sense to me...   you need to run the exact same command but wrap it in a RunWait()  command. ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)
39 minutes ago, Jos said:

That doesn't make any sense to me...   you need to run the exact same command but wrap it in a RunWait()  command. ;) 

I do not understand. I tried, but can't get the command into runwait wrapped. Can you give me the example for this exact cmd line:

bitsadmin.exe /transfer "Name" https://www.Site C:\downloads\setup.exe

 

Edited by Kajoe
  • Solution
Posted (edited)
23 hours ago, Nine said:

Here one way to perform and check for error

Local $sCmd = 'bitsadmin /transfer testdl http://www.autoitscript.com/autoit3/files/beta/update.dat c:\apps\update.dat'
ConsoleWrite($sCmd & @CRLF)
Local $iPID = Run(@comspec & " /K " & $sCmd, "c:\apps", @SW_SHOW)
ConsoleWrite(@error & "/" & $iPID & @CRLF)

 

Hi Nine,

Thank you very much. It is working flawlesly.

I have only one problem left. When download is finished it does not shutdown CMD automaticly. I want it to close after download is completed to run the next step in script.  What line do I need to close CMD after download? 

 

I found the solution for it on Forum. I need to use /C. So problem solved. Great. 


Thank you very much for your help. I realy appreciate it.

Edited by Kajoe
CMD screen not closing after download. Found solution for closing CMD

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...