how to run app on exit of cmd

Windows Vista Discussion in 'Windows' started by GoodOlJoe, Jul 26, 2012.

  1. GoodOlJoe

    GoodOlJoe

    Joined:
    Jul 26, 2012
    Likes Received:
    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
     
    GoodOlJoe, Jul 26, 2012
    #1
    1. Advertisements

  2. GoodOlJoe

    alow Excel Formulator

    Joined:
    Mar 20, 2012
    Likes Received:
    3
    Location:
    US
    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.
     
    alow, Jul 26, 2012
    #2
    1. Advertisements

  3. GoodOlJoe

    alow Excel Formulator

    Joined:
    Mar 20, 2012
    Likes Received:
    3
    Location:
    US
    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.
     
    alow, Jul 26, 2012
    #3
  4. GoodOlJoe

    GoodOlJoe

    Joined:
    Jul 26, 2012
    Likes Received:
    0

    Yes. But what about running an app on exit of the ipconfig cmd window?
     
    GoodOlJoe, Jul 26, 2012
    #4
  5. GoodOlJoe

    alow Excel Formulator

    Joined:
    Mar 20, 2012
    Likes Received:
    3
    Location:
    US
    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.
     
    alow, Jul 26, 2012
    #5
  6. GoodOlJoe

    GoodOlJoe

    Joined:
    Jul 26, 2012
    Likes Received:
    0

    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.
     
    GoodOlJoe, Jul 27, 2012
    #6
  7. GoodOlJoe

    alow Excel Formulator

    Joined:
    Mar 20, 2012
    Likes Received:
    3
    Location:
    US
    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?
     
    alow, Jul 27, 2012
    #7
  8. GoodOlJoe

    GoodOlJoe

    Joined:
    Jul 26, 2012
    Likes Received:
    0
    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
     
    GoodOlJoe, Jul 27, 2012
    #8
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Taffycat

    Windows Vista Vista tweaking app advice

    Taffycat, Aug 17, 2008, in forum: Windows
    Replies:
    2
    Views:
    667
    Taffycat
    Aug 17, 2008
  2. mrkelley80

    Windows Vista cmd FORFILES illogical date selection?

    mrkelley80, Nov 9, 2008, in forum: Windows
    Replies:
    2
    Views:
    1,503
    mrkelley80
    Nov 10, 2008
  3. Abarbarian

    Windows 7 Windows 7 will run 120 days for free

    Abarbarian, Aug 21, 2009, in forum: Windows
    Replies:
    1
    Views:
    1,114
    floppybootstomp
    Aug 21, 2009
  4. Moss

    Windows 7 Office 2010 run time error

    Moss, Jan 20, 2011, in forum: Windows
    Replies:
    0
    Views:
    1,551
  5. Ellen
    Replies:
    1
    Views:
    2,699
    Silverhazesurfer
    Oct 9, 2011
  6. 1bru1
    Replies:
    0
    Views:
    1,209
    1bru1
    Jan 27, 2012
  7. EvanDavis

    Windows 7 CMD pop up

    EvanDavis, Feb 28, 2013, in forum: Windows
    Replies:
    7
    Views:
    1,224
  8. Anon_F

    Windows 7 C:\Windows\System32\cmd.exe

    Anon_F, Feb 10, 2016, in forum: Windows
    Replies:
    10
    Views:
    501
    Anon_F
    Feb 11, 2016
Loading...