When I open the command prompt, it automatically closes itself after 2-3 seconds. Can anyone help me why Command Prompt in Windows 7 automatically hides after 2-3 seconds?
You could have a virus running on the system that is closing the command prompt, in order to make it more difficult for you to remove the virus.
Perhaps it is killing processes that are named
cmd.exe. I suggest that you make a copy of
cmd.exe and call it
abcd.exe. Then run
abcd.exe and see if it keeps running.
If you are writing a program that executes on the command line, and running it directly from your IDE, not by typing the program name in manually, the command prompt window will close as soon as the program finishes executing. To avoid this, either manually open a command prompt, entering the executable name to run it, or stick a
getchar call or equivalent at the end of your program.
Are you using Windows 7 build 7000 ? According to this topic, there are known bugs in that build for command prompt and network drives. You can check build version by opening up cmd, see image :
As you see my windows 7 build version is 7601. The lastest version so far. So if your version is before 7601, I suggest you to update to the lastest version.