一个CMD界面输入多条命令
例子1
Loop, 2 { Run, %comspec% /c `" type dir.txt`" }
大家运行后发现打开了两个cmd窗口。
解决方案:
Run, %comspec%,,, PID Sleep, 50 Loop, 2 SendInput, type dir.txt{Enter}
还有一种方法
setworkingdir,%a_desktop% ;- directory of file f1 ;--- for test ------------ f1=%a_desktop%\dir.txt ifnotexist,%f1% fileappend,aaa bbbb`r`ncccc dddd`r`n-----------`r`n,%f1% ;------------------------- e4x= (Ltrim Join& type dir.txt type dir.txt ) Run, %COMSPEC% /k %e4x%,,,pid2 ;- start DOS and send commands WinWait, ahk_pid %pid2% sendinput,ver`n ;- another command if needed return