Go home on Windows

People from the Linux/ UNIX/ MacOS world wonder about the HOME on Windows and this came up in a Twitter thread recently.

The response on how to make HOME more visible and present on Windows was a bit longer than a tweet, so I decided to write this up.

Where is home?

The first question we have to ask: where is HOME?

Home on Windows is identified by using two environment variables:

  • HOMEDRIVE
  • HOMEPATH

Type set HOME into a command prompt to see the settings of these variables. The actual home directory then is: %HOMEDRIVE\%HOMEPATH – in my case, this comes out as:

>set HOME
HOMEDRIVE=C:
HOMEPATH=\Users\mohit

Going HOME Quicker

The complaint is that Windows hides this away but here are 3 things that I do to make it easier to find and go to:

  • Add to the desktop
  • Pin to the Quick Access Background
  • Shortcut batch file

Adding to the desktop

The Windows desktop is, of course, a common place to start. By default, the desktop does not have an icon for the HOME directory. You can enable that by doing this.

  • Right click on the desktop and click on’Peronalise’
  • Next click on Themes and in the list on the right, click on Desktop Icon Settings under Related Settings
  • This brings up a boring old-school dialog to enable desktop icons – check the icon for User's Files

This will then add an icon on the desktop and double clicking on it will take you to the HOME directory/ folder.

Customise what Explorer Opens

Hitting Windows Key + E will launch explorer. You can choose what this opens up to. Start Explorer and in the ribbon, do this:

  • Click on View
  • Then, click on Options (far right) and then select Change folder and search options
  • In the box that pops up, change the option to ‘Open File Explorer to:’ from ‘This PC’ to ‘Quick Access’ and click Apply or OK

Assuming you added your HOME to the quick access, you can now double click on the HOME when Explorer opens to the Quick Access. I personally prefer the option to leave it to open to ‘This PC’ since that gives me the drives, etc. which I use more.

Pinning to Quick Access

Whenever you open an Explorer windows (Windows Key + E), it will usually also show an area called the Quick Access which has some folders (usually things like Documents, Dropbox, OneDrive, etc.). These are automatically learned or explicitly added by the user or by the installers.

Double click on the new icon on your desktop and go to the folder for the home directory. Click on the Add to Quick Access on the top left.

Now, every time you open the explorer window (or in any open Explorer window), you can easily find the HOME folder.

If you want to change the icon, you have to go to the base path of the directory (c:\users in my case) and then right click on the specific folder and then go through the properties to change the icon.

Adding a Command Script

I usually have a folder such as D:\Tools which is on my path and I add utility command files there that do simple things for me. One of these is called home.cmd and has this code in it.

cd %HOMEDRIVE%%HOMEPATH%

This way, in any console, I can just type home and it will take me to that directory on the command line. For PowerShell, you can either define a custom function or have just this in a script called home.ps1

$user_home = [Environment]::ExpandEnvironmentVariables('%HOMEDRIVE%%HOMEPATH%')
cd $user_home

Hope this helps. If you have any comments, do add them below and I will see if I can reflect that into the post.

comments powered by Disqus