Windows

Redirect the Command Prompt to a folder of your choosing in Windows XP

When you open a Command Prompt, from the Start menu or by typing CMD in the Run dialog box, the Command Prompt window will always open in the C:\Documents and Settings\{yourname} folder. However, having the Command Prompt window open in that folder by default may not always be convenient. Greg Shultz shows you how to reconfigure the Command Prompt shortcut to open in any folder you want.

As you probably know, when you open a Command Prompt, from the Start menu or by typing CMD in the Run dialog box, the Command Prompt window will always open in the C:\Documents and Settings\{yourname} folder. (Where {yourname} is the name of your user account.)

The reason for this is that by default Windows XP is programmed to start the Command Prompt in the folder designated by the %HOMEDRIVE%%HOMEPATH% environment variable, which in most cases translates into C:\Documents and Settings\{yourname}.

However, having the Command Prompt window open in the C:\Documents and Settings\{yourname} by default may not always be convenient. As such, you're left to using the CD (Change Directory) command to manually navigate to the folder of your choice. Fortunately, you can reconfigure the Command Prompt shortcut to open in any folder that you want. Here's how:

Right click on the Command Prompt shortcut on the Start menu and select Properties the command.

When you see the Shortcut tab, double-click the Start in text box to select %HOMEDRIVE%%HOMEPATH% environment variable.

Type the path to the folder in which you want the Command Prompt windows to open.

(If you need more flexibility when opening a Command Prompt window than this tip provides, you might be better served by downloading and installing the Open Command Window Here PowerToy from Microsoft.)

Note: This tip applies to both Windows XP Home and Windows XP Professional.

Miss a Windows XP tip?

Check out the Windows XP archive, and get more hands-on Windows XP tips.

Stay on top of the latest XP tips and tricks with our free Windows XP newsletter, delivered each Thursday. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

5 comments
CisfRjsii
CisfRjsii

Try My Direct access CMD Prompt ... This Will Help to open the CMD Prompt at the Location / File / Drive ... Just Cut, from below, create a new .txt Docket ( Document ) paste the Following into your new text Docket & Rename Ms? DOS Mode.reg instead of .txt Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\Dos Mode] @="Ms? DOS Mode :>" [HKEY_CLASSES_ROOT\Folder\shell\Dos Mode\command] @="cmd.exe /k cd \"%1" Now then; MERGE, Store and when you right click anywhere to enter into dos CMD Your entry point is Direct ... SKYPE: Ziggy.42o(c)tm. SKYPE: +1-912-228-4907 PHONE: +1-912-704-8277 PHONE: +1-518-567-6171 eMail: CisfRjsii@yahoo.com Cisf(c)tm.Rjsii: 1984-(R)-2084 Computer Interface Systems (R) First

Angel_Tech
Angel_Tech

This tip is very usefull in my opinion.. but is there a way to restrict the use of CD to go back one level back from the default Path? ex. If the command prompt opens in c:\Users\Homer\ and then somebody (restricted user) wants to get to the C drive by using the CD command, how do you stop that?..

Photogenic Memory
Photogenic Memory

I installed support tools sometime ago. This changed the path statment to "C:\Program Files\Support Tools\" in one CLI. The other one which is the basic system default path statement is %HOMEDRIVE%%HOMEPATH%. Interesting stuff. They both must interact with the system but probably talk to the OS through their own builtin commands. I wonder if I installed Powershell that it would add an additional path statement and a third CLI interface? You gotta love it?

seanferd
seanferd

Group Policy and file permissions work the same in the CLI as they do in the GUI.

Editor's Picks