Thanks. This works pretty well. I have tested. Maybe the only problem is that all processes are terminated.SKAN wrote: ↑13 May 2020, 15:53Thanks.rommmcek wrote:GetKeyState("Pause", "P")
Works well.. but I feel uncomfortable to use it. I've updated the code to use the global A_Args array instead.
A_Args.RunCMD.PID will now contain the PID of the console process.
I'm not sure whether it will create a problem in a race condition.
You may call A_Args.RunCMD.PID := 0 from a hotkey or routine to exit gracefully... or
call Process, Close, % A_Args.RunCMD.PID to terminate.
If anyone needs a long running process to test the updated function, try this: MsgBox % RunCmd(A_Comspec . " /c Dir *.* /s", "C:")
Code: Select all
df := RunCmd("ping -n 10 192.168.1.35") MsgBox % df return w:: df1 := RunCmd("ping 192.168.1.34") MsgBox % df1 return q:: A_Args.RunCMD.PID := 0 Process, Close, % A_Args.RunCMD.PID return
For example, I can run two commands. If we just want to end one?
I don't know if it's possible, but is it okay to get text before finishing? If I wanted to check the cmd output to see if everything was fine but I did not interfere with the study.
Did I want a lot?