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
Mark LaGrangeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
Use start; e.g. -
start "" "C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe" "C:\MyDoc1.docx" "C:\MyDoc2.docx" "C:\MyDoc3.docx"

Open in new window


-saige-
2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NVITEnd-user supportCommented:
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
0
Dariusz TykaICT Infrastructure Specialist Senior Commented:
You may  try to add 'exit' command at the end of your bat file.
1
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

pgm554Commented:
Yup ,just add exit to the end of the bat file.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Dariusz Tyka and pgm554,

Exit will not work.  The batch file window stays open because it's waiting for Word to finish - until he closes word, it waits.  UNLESS you use START as it_saige stated.

Exit would only work if the batch file were launched from a pre-existing command prompt.  Double-click the batch file to run and Exit is useless.
0
Mark LaGrangeAuthor Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.