Vista Command Prompt

The Command Prompt is a native Windows program that lets you execute commands without using a GUI. You can accomplish pretty much every task in the Command Prompt as you can with the GUI and a mouse. The Command Prompt gets its roots (arguably) from a combination of UNIX and MS-DOS. Consider it “Windows without the windows.”

Microsoft has streamlined your ability to launch Command Prompt sessions in Windows Vista. Besides accessing the Command Prompt through the Start Menu, the following are three other methods to launch the Command Prompt with varying permission-levels.

Shift and Right-Click

You can hold down shift and right-click and you will get the option to “Open Command Window Here.” This will open a Command Prompt that is queued to your current directory.

vista command prompt 01 small

For example, if I use the above command on the desktop, the corresponding Command Prompt session will be set to C:\Users\asdf\Desktop”:

vista command prompt 02 small

Creating an Administrator Session Shortcut

Alternatively, you can create a shortcut to give yourself an elevated (administrator) Command Prompt session by right-clicking on the desktop and creating a shortcut:

vista command prompt 03 small

For the location of the item type “cmd” and click Next:

vista command prompt 04 small

Name the shortcut “cmd” and click Finish:

vista command prompt 05 small

Your shortcut will now be created. Right-click on the shortcut and choose “Properties”:

vista command prompt 06 small

In the properties dialog, select the “Shortcut” tab, and click Advanced…

vista command prompt 07 small

In the Advanced Properties, check “Run as administrator,” and click Ok:

vista command prompt 08 small

Anytime you launch the shortcut, you will have administrator privileges, and your Command Prompt session will start in “C:\Windows\system32” instead of the normal “C:\Users“:

vista command prompt 09 small

Right-click for administrator privileges

Additionally, you can edit the registry to add a right-click option for "Administrator Command Prompt Here." This is useful if you are buried in a directory and want to launch an administrator session on the fly.

vista command prompt 13 small

Note: Editing the registry has the potential to cause serious (and unrecoverable) damage to your PC. If you are at all uncomfortable editing the registry, please do not attempt the following.

Copy the following text into a Notepad file and save the file as AdminPrompt.reg:

 Windows Registry Editor Version 5.00
 


[HKEY_CLASSES_ROOT\Directory\shell\runas] @="Administrator Command Prompt here" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\runas\command] @="cmd.exe /k \"pushd %L && title Command Prompt\"" [HKEY_CLASSES_ROOT\Drive\shell\runas] @="Administrator Command Prompt here" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Drive\shell\runas\command] @="cmd.exe /k \"pushd %L && title Command Prompt\""

Open your registry by clicking the Start Menu and typing “regedit.” Windows will prompt you for confirmation before running the Registry Editor. In the File menu click Import

vista command prompt 10 small

Navigate to your AdminPrompt.reg file and click Open:

vista command prompt 11 small

You will get the following message that says “The keys and values contained in AdminPrompt.reg have been successfully added to the registry.” Click Ok:

vista command prompt 12 small

Whenever you right-click a directory, you will now have the option of launching an Administrator Command Prompt Session queued for that current directory:

vista command prompt 13 small

Summary

Here is what you’ve learned to do:

  • Shift + right-click and open a user-privileged Command Prompt session
  • Right-click and open an administrator-privileged Command Prompt session
  • Create an administrator-privileged Command Prompt shortcut
  • Import a registry file

Related Links