how to run app on exit of cmd

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

  1. GoodOlJoe

    GoodOlJoe

    Joined:
    Jul 26, 2012
    Messages:
    4
    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 VIP Member

    Joined:
    Mar 20, 2012
    Messages:
    759
    Likes Received:
    0
    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 VIP Member

    Joined:
    Mar 20, 2012
    Messages:
    759
    Likes Received:
    0
    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
    Messages:
    4
    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 VIP Member

    Joined:
    Mar 20, 2012
    Messages:
    759
    Likes Received:
    0
    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
    Messages:
    4
    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 VIP Member

    Joined:
    Mar 20, 2012
    Messages:
    759
    Likes Received:
    0
    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
    Messages:
    4
    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

    Vista tweaking app advice

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

    cmd FORFILES illogical date selection?

    mrkelley80, Nov 9, 2008, in forum: Windows Vista
    Replies:
    2
    Views:
    1,316
    mrkelley80
    Nov 10, 2008
  3. tbell0124

    Sfc/scannow wont run in vista

    tbell0124, Jun 11, 2009, in forum: Windows Vista
    Replies:
    1
    Views:
    787
    guest_9323wk
    Jun 11, 2009
  4. jamesvista
    Replies:
    5
    Views:
    1,058
    javaFreek
    Jan 7, 2010
  5. MidnightFalcon69

    Run DLL problem....

    MidnightFalcon69, Oct 18, 2010, in forum: Windows Vista
    Replies:
    1
    Views:
    890
    TriplexDread
    Oct 18, 2010
Loading...

Share This Page