How do I issue commands to Windows comand prompt using AutoIt? What didn't work (I used Sleep()
to make sure it is not skipping because of fast execution):
;Run application
Run("cmd.exe")
;Wait for cmd to be opened
WinWaitActive("Administrator: C:\Windows\system32\cmd.exe", "", 15)
;Write some commands on cmd
ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "Edit1", "cd\")
Sleep(10000)
Send("{Enter}")
Sleep(10000)
ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "Edit1", "cd C:\Program Files (x86)\Jenkins")
Sleep(10000)
Send("{Enter}")
ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "Edit1", "jenkins.exe start")
Sleep(10000)
Send("{Enter}")