1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Closing another cmd.exe window from batch script? Opposite of START cmd.exe /k "...." ?

Discussion in 'Windows XP' started by Cindy Parker, Sep 8, 2010.

  1. Cindy Parker

    Cindy Parker Flightless Bird

    From a DOS batch script under WinXP I launched another CommandPrompt and start a program "myserver" in
    this new window with a command like:

    START cmd.exe /k "myserver parm1 parm2"

    The original initiating batch script ends.

    Then - after a while - I start another DOS batch script and
    want to close this previously created other cmd.exe window.

    How can I do this?

    I don't want to touch the program "myserver".
    All necessary stuff should be done in the closing batch script.
    And of cause I don't want to manually enter "exit" in the CommandPrompt to be closed.
    All should be done automatically in/from a closing supervisor batch script.

    In other words: I need the opposite of the START command.
    Unfortunately there is no command like:

    CLOSE "cmd.exe -title=myserver"

    Is there a work around for that?

    Cindy
     
  2. Bob I

    Bob I Flightless Bird

    Re: Closing another cmd.exe window from batch script? Opposite ofSTART cmd.exe /k "...." ?

    Cindy Parker wrote:

    > From a DOS batch script under WinXP I launched another CommandPrompt and start a program "myserver" in
    > this new window with a command like:
    >
    > START cmd.exe /k "myserver parm1 parm2"
    >
    > The original initiating batch script ends.
    >
    > Then - after a while - I start another DOS batch script and
    > want to close this previously created other cmd.exe window.
    >
    > How can I do this?
    >
    > I don't want to touch the program "myserver".
    > All necessary stuff should be done in the closing batch script.
    > And of cause I don't want to manually enter "exit" in the CommandPrompt to be closed.
    > All should be done automatically in/from a closing supervisor batch script.
    >
    > In other words: I need the opposite of the START command.
    > Unfortunately there is no command like:
    >
    > CLOSE "cmd.exe -title=myserver"
    >
    > Is there a work around for that?
    >
    > Cindy
    >


    replace /k with /c
     
  3. Pegasus [MVP]

    Pegasus [MVP] Flightless Bird

    "Cindy Parker" <cypy@live.com> wrote in message
    news:4c874be5$0$6992$9b4e6d93@newsspool4.arcor-online.net...
    > From a DOS batch script under WinXP I launched another CommandPrompt and
    > start a program "myserver" in
    > this new window with a command like:
    >
    > START cmd.exe /k "myserver parm1 parm2"
    >
    > The original initiating batch script ends.
    >
    > Then - after a while - I start another DOS batch script and
    > want to close this previously created other cmd.exe window.
    >
    > How can I do this?
    >
    > I don't want to touch the program "myserver".
    > All necessary stuff should be done in the closing batch script.
    > And of cause I don't want to manually enter "exit" in the CommandPrompt to
    > be closed.
    > All should be done automatically in/from a closing supervisor batch
    > script.
    >
    > In other words: I need the opposite of the START command.
    > Unfortunately there is no command like:
    >
    > CLOSE "cmd.exe -title=myserver"
    >
    > Is there a work around for that?
    >
    > Cindy
    >


    You can use the command

    tasklist | find /i "cmd"

    to extract the Process-ID of the command processor you wish to terminate,
    then use the command

    taskkill /PID xxx

    to kill that process.
     
  4. Tim Meddick

    Tim Meddick Flightless Bird

    Yes, Bob, using the /c switch in the line that starts the "myserver"
    program turns it's meaning from : /k[ontinue] to : /c [and close]

    ==

    Cheers, Tim Meddick, Peckham, London. :)




    "Bob I" <birelan@yahoo.com> wrote in message
    news:eKIO$L1TLHA.4344@TK2MSFTNGP02.phx.gbl...
    >
    >
    > Cindy Parker wrote:
    >
    >> From a DOS batch script under WinXP I launched another CommandPrompt and
    >> start a program "myserver" in this new window with a command like:
    >>
    >> START cmd.exe /k "myserver parm1 parm2"
    >>
    >> The original initiating batch script ends.
    >>
    >> Then - after a while - I start another DOS batch script and
    >> want to close this previously created other cmd.exe window.
    >>
    >> How can I do this?
    >>
    >> I don't want to touch the program "myserver".
    >> All necessary stuff should be done in the closing batch script.
    >> And of cause I don't want to manually enter "exit" in the CommandPrompt
    >> to be closed.
    >> All should be done automatically in/from a closing supervisor batch
    >> script.
    >>
    >> In other words: I need the opposite of the START command.
    >> Unfortunately there is no command like:
    >>
    >> CLOSE "cmd.exe -title=myserver"
    >>
    >> Is there a work around for that?
    >>
    >> Cindy
    >>

    >
    > replace /k with /c
    >
     

Share This Page