What I have tried and didn't work:
- I opened
cmd.exe
- Typed "cd\" >> without quotes
- Pressed Enter
- Typed "cd C:\Program Files (x86)\Jenkins"
- Pressed Enter
- Typed "jenkins.exe start"
- Pressed Enter
I have also used the sleep
command after every type, just to make sure that 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}")
I got the answer:
ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "", "cd C:\Program Files (x86)\Jenkins")
I needed to remove "Edit" , as cmd is not an editable window.