How To Guides Org

Bat file: Do not close window

So you’ve been running some bat(ch) files lately and testing them is sort of difficult because the window always closes? How about reading this guide to stop that.


1. Step Open your batch file
2. Step Go to the last line and add one word: pause
3. Step That was easy, huh?

Here’s an example: Let’s say we have a 1-line batch file that we use to share some folders via our LAN as explained in the tutorial (follow blue link), then we would simply add pause at the end


net share test=C:/testfolder
pause

Now when you execute the bat file, it will not close the window. Instead it will ask the user to press a key to continue.