none
Why can Exit not able to close CMD? RRS feed

  • Question

  • I would like to know on why Exit cannot able to close CMD?

    Does anyone have any suggestions?
    Thanks in advance for any suggestions

    Batch File:

    "C:\Program Files (x86)\App Folder\ABC.exe"
    EXIT


    Thanks in advance for any suggestions

    Thursday, November 24, 2016 1:36 PM

Answers

  • Just a guess, but I have seen people sometimes have trouble with START because it gets confused about whether the first argument string on the command line is a title or the command to be executed.  You might just try adding a blank title as the first argument, like this ...

      start "" "C:\Program Files (x86)\App Folder\ABC.exe"


    Tom Lavedas

    Friday, November 25, 2016 6:11 PM
    Moderator

All replies

  • How do you run your batch file? With a double click?

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Thursday, November 24, 2016 2:26 PM
  • Yes, I double click the batch file.

    Do you have any suggestions on what wrong it is?
    Thank you very much for any suggestions :>


    Thanks in advance for any suggestions

    Thursday, November 24, 2016 2:38 PM
  • There is an endless loop in your batch file or it is starting a program with wait.


    \_(ツ)_/

    Thursday, November 24, 2016 3:00 PM
  • No. I don't know what could be the solution, sorry. Did you search for? I fould this: http://www.thefreewindows.com/82/close-a-batch-dos-window-automatically-after-execution/ 

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Thursday, November 24, 2016 3:00 PM
  • There is no loop on batch file, it simply run a program and close CMD, that is all.

    Does anyone have any suggestions on what wrong it is?
    Thanks, everyone very much for any suggestions :>

    

    Batch File:

    "C:\Program Files (x86)\App Folder\ABC.exe"
    EXIT


    Thanks in advance for any suggestions

    Thursday, November 24, 2016 3:46 PM
  • Try to create another batch file with only one line in it ... like this:

    C:\Windows\System32\ipconfig.exe

    If this does the trick then your 'ABC.exe' won't give up the focus and you've got your solution.  :-)


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Thursday, November 24, 2016 3:53 PM
  • The batch file will not close until the program is closed.

    Use this

    start "C:\Program Files (x86)\App Folder\ABC.exe"

    If the program prompts for input then the batch will not complete.

    No need to use "exit"


    \_(ツ)_/

    Thursday, November 24, 2016 3:53 PM
  • Try to create another batch file with only one line in it ... like this:

    C:\Windows\System32\ipconfig.exe

    If this does the trick then your 'ABC.exe' won't give up the focus and you've got your solution.  :-)


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    The quote "path\file name" cannot be removed, because space is existed between words

    Does anyone have any suggestions?
    Thanks, everyone very much for any suggestions :>


    Thanks in advance for any suggestions

    Thursday, November 24, 2016 9:00 PM
  • The batch file will not close until the program is closed.

    Use this

    start "C:\Program Files (x86)\App Folder\ABC.exe"

    If the program prompts for input then the batch will not complete.

    No need to use "exit"


    \_(ツ)_/

    When I try adding start at the beginning of code, it cannot run the program at all.

    start "C:\Program Files (x86)\App Folder\ABC.exe" (Not able to run)

    "C:\Program Files (x86)\App Folder\ABC.exe" (Able to run)

    Does anyone have any suggestions?
    Thanks, everyone very much for any suggestions :>


    Thanks in advance for any suggestions

    Thursday, November 24, 2016 9:02 PM
  • WHAT?

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Thursday, November 24, 2016 9:05 PM
  • You need to contact the vendor of the file to find out why it hangs when executed.

    This is not a scripting issue it is a problem with the EXE you are trying to run.


    \_(ツ)_/

    Thursday, November 24, 2016 9:10 PM
  • Just a guess, but I have seen people sometimes have trouble with START because it gets confused about whether the first argument string on the command line is a title or the command to be executed.  You might just try adding a blank title as the first argument, like this ...

      start "" "C:\Program Files (x86)\App Folder\ABC.exe"


    Tom Lavedas

    Friday, November 25, 2016 6:11 PM
    Moderator
  • Good call Tom.

    The last string on the line is always the command even when no title is present.

    start notepad

    If you quote it then you need t also use a title.

    start "notepad" <<<---- fails
    start "" "notepad  <<<--- works


    \_(ツ)_/

    Friday, November 25, 2016 6:28 PM