FinalVersion Posted February 12, 2010 Posted February 12, 2010 Lets say I've run this. Run(@ComSpec & "ping google.com -n 100") The only way to stop it is with Ctrl+C. Now seeing as I haven't used /k, the Command Prompt window isn't visible. How can I send Ctrl+C? I'm 99.9% sure I can use "ControlSend", but I don't know for certain, or know how to do it. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
FinalVersion Posted February 12, 2010 Author Posted February 12, 2010 Anyone? [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
MHz Posted February 12, 2010 Posted February 12, 2010 The syntax seems to be incorrect. i.e path\to\cmd.exeping Run() does return the ProcessID. You can just use ProcessClose($pid) if $pid contains value that resulted form Run() i.e $pid = Run('some file'). Or Using RunWait() and the /c switch on @Comspec seems like a better concept to me. Unless you wish to be more gracious about the procedure and make it harder for yourself then what perhaps is needed.
FinalVersion Posted February 12, 2010 Author Posted February 12, 2010 I'm open to suggestions, but what does "/c" do? [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
MHz Posted February 12, 2010 Posted February 12, 2010 I'm open to suggestions, but what does "/c" do?If you know how to use a command prompt then try typing in cmd /? and pressing the return key./c automatically terminates the cmd process once the commands passed are complete.
FinalVersion Posted February 12, 2010 Author Posted February 12, 2010 Ah, Lets just say half way through the command, I wanted to end it. Not when the command is finished. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
MHz Posted February 12, 2010 Posted February 12, 2010 Ah, Lets just say half way through the command, I wanted to end it. Not when the command is finished. As in a single CMD command?You could ProcessClose() it.Perhaps the best way to control CMD (@Comspec) is by using the STDIN, STDOUT and/or STDERR parameters in Run(). Something for you to play with.
FinalVersion Posted February 12, 2010 Author Posted February 12, 2010 Actually never mind, I got it myself. Run(@ComSpec & " ping google.com -n 100", "", @SW_HIDE) And if I wanted to end it simply. ProcessClose("cmd.exe") [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now