2 Methods to Get Home Directory on Windows

2 Methods to Get Home Directory on Windows

Understanding how to access the home directory, often known as the user profile directory, is fundamental for efficient navigation and management of the individual files, settings, and configurations on a Windows system. The home directory serves as a centralized hub where the personalized data resides, encompassing documents, downloads, desktop items, app settings, and much more. This tutorial provides 2 methods how to get home directory on Windows.

Method 1 - CMD

To obtain the home directory using Command Prompt (CMD), we can utilize the echo command along with the %USERPROFILE% environment variable, which holds the path to the user's home directory.

echo %USERPROFILE%

Output example:

C:\Users\John

Method 2 - PowerShell

To retrieve the home directory using PowerShell, we can utilize the $HOME automatic variable, which holds the path to the current user's home directory.

$HOME

Leave a Comment

Cancel reply

Your email address will not be published.