Kajoe Posted November 10, 2021 Posted November 10, 2021 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
Nine Posted November 11, 2021 Posted November 11, 2021 (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 November 11, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Developers Jos Posted November 11, 2021 Developers Posted November 11, 2021 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.
Kajoe Posted November 11, 2021 Author Posted November 11, 2021 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?
Kajoe Posted November 11, 2021 Author Posted November 11, 2021 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 Jos Posted November 11, 2021 Developers Posted November 11, 2021 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.
Kajoe Posted November 11, 2021 Author Posted November 11, 2021 (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 November 11, 2021 by Kajoe
Nine Posted November 11, 2021 Posted November 11, 2021 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) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Solution Kajoe Posted November 12, 2021 Author Solution Posted November 12, 2021 (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 November 12, 2021 by Kajoe CMD screen not closing after download. Found solution for closing CMD
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now