Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

  On 2/12/2010 at 1:08 PM, 'FinalVersion said:

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.

Posted

  On 2/12/2010 at 1:32 PM, 'FinalVersion said:

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. :mellow:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...