Nunos Posted February 8, 2019 Posted February 8, 2019 I have a batch file that runs some cmds and I am trying to get it converted into AutoIT so it can be compiled to an EXE. A couple of the cmds I don't understand how they work so I was trying to break them into two separate batch files and call them from within AutoIt. Attached are the two batch files and below is the script. FileInstall("C:\MDStop.bat", @ScriptDir & "\MDStop.bat", 1) FileInstall("C:\MDStart.bat", @ScriptDir &"\MDStart.bat", 1) Local $iPID = Runwait(@ComSpec & ' /K "' & @ScriptDir & '\MDStop.bat"', "", @SW_SHOW) ProcessClose($iPID) Sleep(3000) Local $sPID = RunWait(@ComSpec & ' /K "' & @ScriptDir & '\MDStart.bat"', "", @SW_SHOW) ProcessClose($sPID) Sleep(3000) The problem I am having is that both of the cmd console windows stay open after the script is finished. Not sure what I am missing or if there is a better way to run the information in the two batch files so I can dump them? MDStart.bat MDStop.bat
Subz Posted February 8, 2019 Posted February 8, 2019 (edited) Use "/c" rather than "/k" Thought your batch files would be more complicated, why don't you just use: Local $iPID $iPID = Runwait(@ComSpec & ' /c c:\posera\maitred\prg\srvman.exe /fc:\posera\maitred\data\bo.ini /x30187 /ac256 /al0', "", @SW_SHOW) ProcessClose($iPID) Sleep(3000) $iPID = RunWait(@ComSpec & ' /c c:\posera\maitred\prg\srvman.exe /fc:\posera\maitred\data\bo.ini /x30176 /ac256 /al0 /y', "", @SW_SHOW) ProcessClose($iPID) Sleep(3000) Edited February 8, 2019 by Subz
Nunos Posted February 9, 2019 Author Posted February 9, 2019 20 hours ago, Subz said: Use "/c" rather than "/k" Thought your batch files would be more complicated, why don't you just use: Local $iPID $iPID = Runwait(@ComSpec & ' /c c:\posera\maitred\prg\srvman.exe /fc:\posera\maitred\data\bo.ini /x30187 /ac256 /al0', "", @SW_SHOW) ProcessClose($iPID) Sleep(3000) $iPID = RunWait(@ComSpec & ' /c c:\posera\maitred\prg\srvman.exe /fc:\posera\maitred\data\bo.ini /x30176 /ac256 /al0 /y', "", @SW_SHOW) ProcessClose($iPID) Sleep(3000) I will give that a go tonight when I get home from work and let you know if it works. Thank you,
Nunos Posted February 9, 2019 Author Posted February 9, 2019 I get an error from the Maitre'D program that says User Not have Menu Order Access I am not sure what this is and also the two cmd consoles stay open blank but I think that can be closed by changing the @SW_Show to @SW_HIDE. Not sure what to make of the user access error though.
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