Link to home
Start Free TrialLog in
Avatar of Mark LaGrange
Mark LaGrange

asked on

How to close DOS window after bat file execution?

Hello - I made the following .bat to open 3 Word doc's I work with everyday:

"C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe" "C:\MyDoc1.docx" "C:\MyDoc2.docx" "C:\MyDoc3.docx"

So I can be as lazy as possible, how can I get the DOS window to close after the doc's have opened?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How is the bat being run? Usually it closes automatically.
I haven't confirmed this but if it's run via a shortcut like...
cmd /k your.bat

Open in new window

.. The cmd window will stay open. Changing that to...
cmd /c your.bat

Open in new window

... Will close the window as expected

https://ss64.com/nt/cmd.html
You may  try to add 'exit' command at the end of your bat file.
Yup ,just add exit to the end of the bat file.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark LaGrange
Mark LaGrange

ASKER

Thanks!