TechSpot

Command Prompt Won't Remain Open When Running C/C++ Scripts

By Jasio-
Mar 14, 2007
  1. Just wondering how to fix this, whenever I run a C/C++ script, the command prompt window will close as soon as the task is complete. I would prefer it remain open to read the status, or run other tasks on it.

    Thanks,
    Ross
     
  2. LNCPapa

    LNCPapa TS Special Forces Posts: 4,189   +415

    Putting a pause at the end should keep it open - but not allow you to use the command window after that.
     
  3. Jasio-

    Jasio- TS Rookie Topic Starter Posts: 70

    Is there any way to keep it from automatically closing?.. something preferably that isn't required in the script itself.
     
  4. jobeard

    jobeard TS Ambassador Posts: 8,946   +586

    try using RETURN instead of EXIT?
     
  5. SNGX1275

    SNGX1275 TS Forces Special Posts: 10,681   +392

    What if you open a command prompt first, then execute the script from within the prompt. I don't know the context in which you are running, but for example typing ipconfig from the Start -> Run leaves the window open in 9x, but in 2k and beyond it doesn't, so you have to launch the command prompt first, then enter ipconfig.
     
  6. tipstir

    tipstir TS Ambassador Posts: 2,383   +105

    put a wait trigger in the script so it doesn't close out on you..
     
  7. jobeard

    jobeard TS Ambassador Posts: 8,946   +586

    try run->cmd /k $any-command
    the window is retained AFTER the completion of $any-command
    ie: /k == KEEP :)
     
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...