Announcement

Collapse
No announcement yet.

Automatically close the DOS Command Shell window (after last line)?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatically close the DOS Command Shell window (after last line)?

    I have a batch file named "test.cmd".

    The file contains 1 line:
    "C:\Test\test.txt"

    The goal is to open the file "C:\Test\test.txt", that's working.
    But the DOS Command Shell window remains open until I close the txt-file manually.

    So, my question is: How to automatically close the DOS Command Shell window after opening "C:\Test\test.txt"?

  • #2
    The batch is waiting for the exit code, therefore it wait for it to terminate. If you don't want the batch to wait use the START command.

    @start "" "C:\Test\test.txt"
    !!! mind the quotes before the path. The START command assumes that the first text between quotes in the command line is the TITLE, so if the path is between quotes you'll have to add text between quotes to the command line before the path.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Originally posted by Rems View Post
      The batch is waiting for the exit code, therefore it wait for it to terminate. If you don't want the batch to wait use the START command.

      @start "" "C:\Test\test.txt"
      !!! mind the quotes before the path. The START command assumes that the first text between quotes in the command line is the TITLE, so if the path is between quotes you'll have to add text between quotes to the command line before the path.
      Thank you for your reply and for the solution Rems!

      Comment

      Working...
      X