Sign in to follow this  
Followers 0
vrocco

Closing cmd.exe after command line runs

6 posts in this topic

I wrote a script to send info to a command line program. However, I noticed after I tested it a few times, I have several instances of cmd.exe open in the task manager. Is there a way to close out cmd.exe after the command completes successfully?

I don't want to use a ProcessClose () with a Sleep, because there is no way to tell if the command is done running (one of the options could take up to 5 minutes to finish)

If someone can help, please post a response.

Thanks

vrocco

Share this post


Link to post
Share on other sites



I wrote a script to send info to a command line program. However, I noticed after I tested it a few times, I have several instances of cmd.exe open in the task manager. Is there a way to close out cmd.exe after the command completes successfully?

I don't want to use a ProcessClose () with a Sleep, because there is no way to tell if the command is done running (one of the options could take up to 5 minutes to finish)

If someone can help, please post a response.

Thanks

vrocco

Welcome to the forum. Are you using the Run() or RunWait() functions to run your functions? If not, can you post a small piece of code that shows the problem you are having?

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

The /c parameter indicates the window should close once it is completed. The /k parameter indicates staying open.

cmd /c <command>
cmd /k <command>

Example:

Run("cmd /c ping 127.0.0.1","",@SW_SHOW)
Run("cmd /k ping 127.0.0.1","",@SW_SHOW)

Share this post


Link to post
Share on other sites

Cool thanks! I will try it with the /c switch.

Share this post


Link to post
Share on other sites

Worked like a charm.......thanks for not flaming a n00b

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0