Windows Vista how to run app on exit of cmd

Joined
Jul 26, 2012
Messages
4
Reaction score
0
Hi all,

I'd like to be able to click on an icon one time and have these things happen.

1. %SystemRoot%\system32\cmd.exe /k ipconfig (opens cmd box and checks ip)
2. Exit (exits the cmd box)
3. "C:\Program Files (x86)\RunThisProgram.exe" (runs an outside of cmd app)

Can it be done and if so how?
Thanks in advance,
Joe
 
Joined
Mar 20, 2012
Messages
764
Reaction score
4
Start a new text document and type the following:

ipconfig
start "" "C:\Program Files (x86)\Program Directory"


Then, save the file as a .bat and it should do what you're looking for.
 
Joined
Mar 20, 2012
Messages
764
Reaction score
4
also... if you wanted it to wait after the ipconfig for you to press a key, you could put a pause command as the second line between those.
 
Joined
Jul 26, 2012
Messages
4
Reaction score
0
also... if you wanted it to wait after the ipconfig for you to press a key, you could put a pause command as the second line between those.


Yes. But what about running an app on exit of the ipconfig cmd window?
 
Joined
Mar 20, 2012
Messages
764
Reaction score
4
If you follow the instructions together and change the file extension of the text file from txt to bat, it should do what you want. The first post will do an ipconfig, then close the command window and start the program you put in the second line. The second post was just something I remembered after posting, that you can use the pause command to wait for user interaction. For the start command, make sure you have all the quotes in place, or it won't work.
 
Joined
Jul 26, 2012
Messages
4
Reaction score
0
If you follow the instructions together and change the file extension of the text file from txt to bat, it should do what you want. The first post will do an ipconfig, then close the command window and start the program you put in the second line. The second post was just something I remembered after posting, that you can use the pause command to wait for user interaction. For the start command, make sure you have all the quotes in place, or it won't work.


Ok I tried this and first let me say I have had a lot of DOS experience writing batch files so I'm not new to it but anyway I finally got it to work but the only way I could make it work is to call more than one bat file. I could not get this process to work using only one batch file. The called program would not return control to the bat file but if you run the second process (the calling of the exe app) from the 2nd bat file, then it will work.
 
Joined
Mar 20, 2012
Messages
764
Reaction score
4
I might be confused on what you were going for then. The commands I gave you would indeed run ipconfig and then a program with closing the command window, but did you want the ipconfig to launch in a separate window and stay open?
 
Joined
Jul 26, 2012
Messages
4
Reaction score
0
I might be confused on what you were going for then. The commands I gave you would indeed run ipconfig and then a program with closing the command window, but did you want the ipconfig to launch in a separate window and stay open?

Hi and thanks for the help.
What I did was to try and open a cmd window, run a cmd and then on exit run one of my installed exe apps. I could not do it from one bat file. See if you can and if it works post the few lines here. I'll place my own cmd and app in place of the ones you use and see if it works for me. I tried everything I could think if and it still would not work as if there might be a bug in the cmd module in vista. Thanks alot.

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top