PC Review


Reply
Thread Tools Rate Thread

how to run app on exit of cmd

 
 
New Member
Join Date: Jul 2012
Posts: 4
 
      26th Jul 2012
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
 
Reply With Quote
 
 
 
 
Excel Formulator
alow's Avatar
Join Date: Mar 2012
Location: US
Posts: 753
 
      26th Jul 2012
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.
 
Reply With Quote
 
 
 
 
Excel Formulator
alow's Avatar
Join Date: Mar 2012
Location: US
Posts: 753
 
      26th Jul 2012
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.
 
Reply With Quote
 
New Member
Join Date: Jul 2012
Posts: 4
 
      26th Jul 2012
Quote:
Originally Posted by alow View Post
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?
 
Reply With Quote
 
Excel Formulator
alow's Avatar
Join Date: Mar 2012
Location: US
Posts: 753
 
      26th Jul 2012
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.
 
Reply With Quote
 
New Member
Join Date: Jul 2012
Posts: 4
 
      27th Jul 2012
Quote:
Originally Posted by alow View Post
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.
 
Reply With Quote
 
Excel Formulator
alow's Avatar
Join Date: Mar 2012
Location: US
Posts: 753
 
      27th Jul 2012
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?
 
Reply With Quote
 
New Member
Join Date: Jul 2012
Posts: 4
 
      27th Jul 2012
Quote:
Originally Posted by alow View Post
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cmd \\127.0.0.1 to start app as intranet app? =?Utf-8?B?RFhSaWNr?= Microsoft ASP .NET 0 3rd Mar 2007 11:45 PM
Trying to run a CMD Line app from a Windows Service - Help Jack Microsoft VB .NET 2 12th May 2006 04:38 PM
Code to Exit Web App and Exit Internet Explorer =?Utf-8?B?U2FuZHk=?= Microsoft ASP .NET 6 4th Aug 2005 09:28 PM
VB code exit error when run via scheduler giving exit code of (c000008f). connoisseur.infotech@gmail.com Microsoft VB .NET 1 4th Aug 2005 02:31 PM
Exit WinForm app with an exit code Anthony Hughes Microsoft Dot NET Framework Forms 2 22nd Oct 2004 08:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:42 AM.