I am used to using

cd ~

to get right into my home directory. In windows command prompt I have to do

cd Users\username

to get there. Is there a shortcut like the Linux one? It would be nice if I could get there by doing

cd username

Any ideas on how to do this in Windows Vista?

Thanks,
Adam

link|improve this question

79% accept rate
In Unix, there's no need for the tilde. cd with no arguments will change to your home directory. – coneslayer Jul 28 '10 at 12:08
there was a question like this here on su, can't find it. – akira Jul 28 '10 at 12:59
@coneslayer i know but to move a file from one directory to another you use the tilde. – classer Aug 1 '10 at 8:21
feedback

4 Answers

up vote 3 down vote accepted

You can always put a .bat-File somewhere in your %PATH% which does the path changing for you.

link|improve this answer
feedback

Dunno if its a feature of our work login script or a windows default, but I can use cd %HOMEPATH% to achieve that, where HOMEPATH is an environment variable.

link|improve this answer
I see. It still takes a lot to write %HOMEPATH%. Also you can't auto-complete it. Is there a way I can make my username be equal to %HOMEPATH% by making a new command in cmd.exe? – classer Jul 28 '10 at 12:03
feedback

Yes, you can use %HOMEPATH%, which is the full path of the user's home directory.

There are quite a few other useful variables available, such as %OS% (Operating System), or %WINDIR% (Windows system directory). See e.g.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true

for a list.

link|improve this answer
feedback

If you want all user's commmand prompts to start in their "home" directory, create the following registry key as an Expandable String Value (sans quotes, of course):

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun : "cd /d %USERPROFILE%"

If you want only your command prompts to do it:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun : "cd /d %USERPROFILE%"

I make it a practice to keep a c:\Scripts folder in which I keep an "autoexec"-type batch file which I invoke via this key.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.