The Computer Oracle

What is the equivalent of Linux's "~" (tilde) in Windows?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5

--

Chapters
00:00 What Is The Equivalent Of Linux'S &Quot;~&Quot; (Tilde) In Windows?
00:25 Accepted Answer Score 61
00:44 Answer 2 Score 76
00:55 Answer 3 Score 7
01:04 Answer 4 Score 14
01:41 Thank you

--

Full question
https://superuser.com/questions/332871/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #linux #commandline

#avk47



ANSWER 1

Score 76


You can use cd /d %USERPROFILE% if you use cmd.

or you can use cd ~ if you use PowerShell.




ACCEPTED ANSWER

Score 61


cd /d "%HOMEDRIVE%%HOMEPATH%" would do it -- but I 'm not sure if you consider it an improvement.

You can also define an alias for the above command:

doskey cdhome=cd /d "%HOMEDRIVE%%HOMEPATH%"

After this, it's simply cdhome.




ANSWER 3

Score 14


One possibility is to use the subst command from a command prompt:

subst z: C:\Document and Settings\freewind

Any time you navigate to drive Z:, you'll be looking at your user folder.

The downside is that you need to run it every time you log in. I used a batch file and just put it in my startup folder, but there are probably more elegant solutions to this.

The benefit is that unlike a doskey alias, it works universally (windows explorer, browse dialog, etc.), not just when changing directories at the command prompt. It's especially helpful for old programs with old browse dialogs that have drive letters at the topmost level, rather than "desktop".




ANSWER 4

Score 7


You can do this:

cd %homepath%