close

Windows

Cloud

Microsoft 365

PowerShell

Active Directory

Security

Windows Server

Video

Upcoming FREE Conference on Identity Management and Privileged Access Management

Home

Windows Vista

Vista Command Prompt

Daniel Petri

|

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.

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

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:

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

Name the shortcut “cmd” and click Finish:

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

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

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

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“:

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.

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

Navigate to your AdminPrompt.reg file and click Open:

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:

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

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

Article saved!

Access saved content from your profile page. View Saved