我尝试过但没有工作:
cmd.exe
我还在每种类型之后使用sleep
命令,只是为了确保它不会因快速执行而跳过。
;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}")
我得到了答案:
ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "", "cd C:\Program Files (x86)\Jenkins")
我需要删除"编辑" ,因为cmd不是可编辑的窗口。
答案 0 :(得分:6)
直接启动您的计划:
RunWait(@ComSpec & " /c jenkins.exe start", "C:\Program Files (x86)\Jenkins")
答案 1 :(得分:1)
使用&
Exp:
$CMD = 'cd %tmp% & md 1 & md 2 & cd %tmp%/1 & md 3 4 & md "5 6" &'
RunWait(@ComSpec & " /c " & $CMD )
答案 2 :(得分:0)
Run("C:\WINDOWS\system32\cmd.exe")
WinWaitActive("C:\WINDOWS\system32\cmd.exe")
send('cd C:\Program Files (x86)\' & "{ENTER}")
答案 3 :(得分:0)
;Run application
Run("cmd.exe")
;Wait for CMD to be opened
WinWaitActive("Administrator: C:\Windows\system32\cmd.exe", "", 1)
Send('C:' & "{ENTER}")
Send('cd Program Files (x86)' & "{ENTER}")
Send('cd TestAPP' & "{ENTER}")
Send('start testApp.exe' & "{ENTER}")