Let’s suppose you’re working at a Windows computer and you want to do something from the command prompt.  Let’s further suppose that the computer is locked down pretty well, including denying users permission to run cmd.exe and disabling use of the Run dialogue box. Now in this scenario, you’re not interested in hacking the box; you just want to run a quick command, netstat for example.  Your workaround is to create a batch file that runs the command for you.

netstat -an

Type it up in Notepad, save it as a .bat file, and execute it.  Be sure to include the pause, or the batch will terminate before you can read your results.

If this is something you will do repeatedly, you might try writing a batch like the following.

@echo off
color 0A
title My CMD Access
set /p command=Enter Command:
goto command

Further Reading

Batch File Help – Computer Hope.com article

Batch Files – from Rob van der Woude’s Scripting Pages

Batch File Commands – article by Jim Eshelman, good stuff