Introduction: Circumvent Restrictions on CMD.exe or DOS Prompt

Ever been on a computer where you did NOT have permission to run "cmd.exe" in order to operate in DOS mode? Maybe you didn't have the option to click "Start" -> "Run"? Do what you want with a simple batch file despite these silly restrictions.

Addendum: This method was used to provide a shell-like interface on an XP machine running Citrix server. The "full desktop" application was published (looks like Remote Desktop) but wouldn't let me use the shell due to security questions. Many have wondered why exactly I did what I've done below, so now you know the context.

Step 1: Create the Batch File

Picture of Create the Batch File

The first step is to create the batch file. Create a new file on your desktop and name it "shell.cmd" or "dos.bat". Name it anything you like as long as the file extension ends in .cmd or .bat.

Inside the file, put the following code:

@ECHO OFF

REM make all environment changes local to the execution of this script.
SETLOCAL
REM show customized welcome message, version of Windows and a blank line
@ECHO --== Welcome to your customized DOS Batch Shell ==--
VER
ECHO.

REM create loop block where user is prompted for a command and
REM that command is executed, displaying the results.
:cmdloop
REM Display working dir prompt, asking for a command.
@set /p USERCMD=%CD%!
REM "quit" or "exit" will both exit this shell.
@IF "%USERCMD%"=="quit" GOTO END
REM execute the received command.
%USERCMD%
REM go back to the beginning of this block.
@GOTO cmdloop

:end
REM end local environment changes
@ENDLOCAL

REM pause briefly before closing this window
@pause

Step 2: Run the Batch File

Picture of Run the Batch File

If you've given the file the proper extension, the icon should look like a window with a gear as seen below. Double-click on it to run it!

Step 3: It Works! (right?)

Picture of It Works! (right?)

If everything is working, you should be able to enter most any DOS command (whether interactive or not) and it should function correctly. Although I added a "quit" command that will jump OUT of the execution loop and go to a PAUSE, if you type "exit" the batch file will quit execution and close the window immediately.

I wasn't able to figure out a way to echo the greater-than symbol for use with a prompt, so instead I used the exclamation mark (followed by a space, although you can't tell that from the picture). Go ahead and customize your batch file to suit your needs. Try using ASCII codes that create graphics, tables, and so on. Be creative! Try typing "prompt /?" to get some ideas, too.

I created this batch file out of necessity. While at work I was given a very "nerfed" account on a Windows machine, but really needed the output of some simple DOS commands. I hope you find this useful.

Comments

Alexamon (author)2012-04-28

if you can make a command prompt in a batch, you must have cmd not blocked on your computer, or else its crap

Craig Bird (author)Alexamon2012-11-24

maybe the Cmd is not blocked, but access to any shortcut or link maybe? maybe the %windir% is not accessible then in that case this is a good instructable

nice work


alternate option
hit run and copy this in
reg delete"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /va /f


this will unblock most blocked applications

mr.break_it (author)2010-06-10

At the end of your prompt line, there is an exclamation point, to the life reads like: F:\! I know the greater than sign does not work, but i much prefer the right squigly bracket (}) to the exclamation point because it more closely resembles what cmd should look like. Perhaps people want to change the exclamation mark on line 12. let me know if you like this.

HardCoreHacker (author)2008-03-29

I'm using a Vista and I do not know how to make a "file"

Kozz (author)HardCoreHacker2008-03-29

Try going to Start -> Programs -> Accessories -> Notepad. Paste the code (seen above) into the Notepad window, then do File -> Save As -> "prompt.bat" on your desktop. If your administrators REALLY don't want you to get a command prompt of any kind, this instructable will not overcome all restrictions.

memyselfand1 (author)Kozz2009-07-24

Hah, they disabled control panel on the new computers, as well as run, search and deleted all the games.

if you are running xp, right click on the desktop and go to new---> .txt file, that should let you make a script....

won't work. when ever it opens up an instance of cmd, in any form, it says "this has been cancelled due to restrictions in place on this computer".

thegeeke (author)HardCoreHacker2008-11-28

Maybe you should change your user name... or try C++ and learn :). otherwise, right-click your desktop and go to "new"

fwjs28 (author)HardCoreHacker2008-06-26

jeesh

crudeplatypus (author)2008-08-07

um, how about in notepad "start" and save it as a .bat file n your desktop/ much easier

NetDex (author)crudeplatypus2009-08-30

That command is blocked. It is too simple to leave it alone. So the administrator blocked it.

LiquidCheese (author)2008-05-14

I might know a quicker way to get restrictionlessly in MSDOS: open notepad, typ COMMAND.COM, then save it as a batch or command file. What you made up is unique, but I'm just saying there's like.. a quicker way to get into MSDOS. Well done anyway. ;-)

cheatman093 (author)LiquidCheese2009-08-17

if your adminitsrator blocked Command Prompt that wont work

will421 (author)LiquidCheese2009-04-22

Uh... An error will pop up because you`re trying to get cmd.exe(of course).

ClCrow (author)2008-08-20

Well, the computers at the library I go to won't even allow you to save a batch file. Any way to get around that?

will421 (author)ClCrow2009-04-26

Save as .txt and right click go to open with --> Command prompt

TheWelfareWarrior (author)2008-05-21

heh, My school just protected cmd because kids (like myself) were remotely shutting down computers. They thought they solved the problem... but the way they caught us was by looking at which programs were opening and at what time. so now I need to find an instructable for that.

try a program called "run as date" (google to find it) this program may allow you to set up the program to look like you were using it 3 months ago... lol... and if that doesnt work than um... idk what you can do... but i am gonna try to steal classmates passwords using a flash drive that has been case modded to look like it is a usb cable... and then i will be using a program called REFOG. anyone have any better programs that i can use? (sorry to ask a question in a response)

jchar77 (author)girrrrrrr22009-01-10

Keyloggers can seriously damage your computer. I would reconsider what you use

Ha! That would be so fun! I wish my school administrator is dumb enough to leave command alone! Good one!!!!

Arbitror (author)2008-11-20

Here is how to do a greater than sign: >. You can also do that for <, |, etc.

Arbitror (author)Arbitror2008-11-20

oops! like this:
>

Arbitror (author)Arbitror2008-11-20

OK, this isn't working! type a circumflex accent (capital 6) followed by the greaterthan sign. Also works for lessthan(>), and pipes(|).

BatchMan (author)2008-10-31

i made my own version of ms-dos links to internet to get commands so file is small. i will e-mail to ppl if u pm me

Arbitror (author)BatchMan2008-11-20

Would you mind pming it to me?

collard41 (author)2008-10-13

this is a good instructable. because it actually works!!

rimar2000 (author)2008-03-29

Very nice.

Kozz (author)rimar20002008-03-29

Thanks. It's my first Instructable, but I've read enough of them to know what constitutes a good one, so I've tried to do my best.

About This Instructable

10,244views

10favorites

License:

Bio: A programmer ever since I laid my hands on a TRS-80 writing BASIC programs like mad-libs in 1990. Goes back to 1984 if you count ... More »
More by Kozz:Use Google as a ProxyRepair a Window Screen on the cheapImprove your DishDVR UHF Remote Control Reception
Add instructable to: