✕
Share it

Contact me
iPhone / iPad

Tools

Hindi Proof Reader Top Tech Blogs in India QR Code Generator
Make Money Online Earn from Blogging More Tools MS-Excel MS-Word AdSense About Lalit Contact us
TechWelkin Site Logo

TechWelkin

Tips and Tutorials on Computers, Mobiles and Internet

Last updated: 23 September 2017

Stop Command Prompt Window from Closing

August 1, 2012 By Lalit Kumar Leave a Comment

Learn how to stop cmd (command prompt) window for batch files from closing. The .bat files automatically close window after execution. Learn to prevent this.

Although times of MS DOS operating system are more or less gone, but still sometimes we still create batch files (.bat files) to write small programs. Batch files are a series of commands that are executed in sequence one after the other.

People generally write batches of DOS commands or shell commands. When you execute a DOS (Windows) batch file by double clicking the .bat file –the command prompt windows pops up, execute commands quickly and then disappears. If your batch file is short and commands don’t take much time to execute, you may not even properly see the cmd window on screen! It all happens so quickly. This, usually black colored, cmd window will not stay to show how your batch file executed.

Is there is a way prevent cmd window from automatically closing? Yes! There is!

A typical cmd Command Prompt Window.

A typical cmd Command Prompt Window.

If you want the command prompt cmd widnow to stay open after executing the last command in batch file –you should write cmd /k command at the end of your batch file. This command will prevent the command prompt window from closing and you’ll get the prompt back for giving more commands in the cmd window.

A typical use case of this scenario is when you want a command prompt window be ready after auto-execution of certain commands that you always give (For example, changing drive or directory).

I hope this was a useful tip for you. Please let me know if you have any questions about this topic. I will be happy to try and answer it for you. Thank you for using TechWelkin.

Related Articles for More Information:

  1. How to Find MAC Address of Your Network Card
  2. 11 Useful MySQL Commands for Quick Reference
  3. MySQL: Taking Backup by Dumping Table into a File
  4. Programmer’s Notepad: Advanced Text Editor for Windows
  5. Remove Byte Order Mark (BOM) Character
  6. Cheatsheet: Windows 8 Keyboard Shortcuts
Last updated: 23 September 2017 | Published on: 1 August 2012 | Authored and Edited by: Lalit Kumar and Team | Filed as: Home » How-to » Stop Command Prompt Window from Closing

Filed Under: How-to, Programming

Lalit Kumar is the Principal Author and Founder of TechWelkin. He is a web explorer and he enjoys finding useful information on the Internet. He loves to put things together to create a bigger solution. Lalit is passionate about technology, languages and literature. You can contact Lalit via email (techwelkin [at] gmail [dot] com) or Facebook (facebook.com/techwelkin).

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Stories

  • Check Ticket Confirmation PNR Status on WhatsApp
  • Easily Capture Screen and Do Recording on iPhone / iPad
  • Consistent Video Upload is Important for YouTube Channel
  • Conditions for YouTube Channel Monetization
  • How to Get Your First 100 and 1000 Subscribers on YouTube
  • What is the Average Audience Retention for YouTube Channels?
  • Remove Activate Windows Watermark from Windows 10
  • Disadvantages of Using Google Custom Search Engine

Tools

  • Hindi Proof Reader
  • Top Tech Blogs in India
  • QR Code Generator
  • Random Word Generator
  • Strong Password Generator
  • Trace Mobile Numbers

Connect with us

  • Facebook
  • Google+
  • Twitter
  • LinkedIn
  • Pinterest
  • RSS Feed

© 2007-2019 TechWelkin.
The content is copyrighted to Lalit Kumar and may not be reproduced on other websites.
TechWelkin displays Google AdSense ads. See how Google uses data when you're on TechWelkin | Privacy Policy