Command Prompt in a Batch File

Let’s assume you are on a Windows computer, logged in with a User account, and that you want to execute Command Prompt (a.k.a. whatever is left of DOS).

At that point you realise that the Command Prompt shortcut has been hidden from the Accessories folder of the Start Menu.

You are almost certain that you saw some log-on batch file scripts run when you logged in, which means that CMD is not disabled – you just can’t see it.

First, you can try opening My Computer and looking for C:\Windows\System32\cmd.exe but, most probably, the Windows folder (or the entire C:\ drive) will be hidden as well.

Fear not, there is a way around this: you can create your own batch file and execute the hidden CMD inside.

Create a new plain text file using Notepad, or any other text editor you can get your hands on, and put only this command in it:

cmd

Now save this file somewhere (e.g. external hdd, memory stick) with the extension .bat (example: mycmd.bat).

As soon as you execute it, you are in the Command Prompt.

But, let’s say this didn’t work either because, even though the batch file ran, cmd was not accessible for some reason.

Don’t worry, you can still simulate cmd by creating your own scripted version of it.

Edit that text file and change the code to:

@echo OFF
cls
:MYCMD
set /p _doscmd="%cd%>" %=%
%_doscmd%
echo.
goto MYCMD

If you execute this, you will stay in the batch file, able to execute commands as if you were using cmd, until you exit.

Of course, make sure your actions do not abuse any rules/agreements/policies and always use this wisely.

K.