.bat file hangs

Discussion in 'Desktop Computers' started by finsfree, Mar 6, 2019.

  1. finsfree

    finsfree Member

    Messages:
    277
    I have created a simple bat script to copy some files from one location to another. After I run the bat file the command prompt shows up and just hangs there blank. The commands do run just fine, but I'm left with a black hangs command prompt.

    Is there something in the script that I can add to the end to make that black screen not hang there?
     
  2. Jiniix

    Jiniix Well-Known Member

    Messages:
    1,358
    You can add "exit" at the end, closes the script/cmd window when it's finished.
     
  3. finsfree

    finsfree Member

    Messages:
    277
    Nope, tried that.

    I'm running this script as a scheduled task in an application called, "Windows Shutdown Assistant".
     
  4. Trizoy

    Trizoy VIP Member

    Messages:
    4,702
    Could you be hanging on the last command? Example, it could be asking if you want to overwrite files..

    Also, maybe how it's being called? Try double clicking the batch file, if it closes when done, it's probably being called with a CMD /K

    CMD /C Run Command and then terminate

    CMD /K Run Command and then return to the CMD prompt.
     
    Cromewell and TheRealSwede like this.
  5. Cromewell

    Cromewell Administrator Staff Member

    Messages:
    15,348
    That would be my guess too. A long running command. A batch file spawned from explorer should auto close on completion unless you do something like pause to keep the window open.
     

Share This Page