I am trying to get the path to the current user's home directory (e.g. C:\Users\User1
) while respecting different localizations of Windows (which have a different name for the Users
folder).
I have seen solutions in Batch, but isn't there a clean way of doing it in PowerShell?
Use the environment variable $env:USERPROFILE
.
For example:
cd "$env:USERPROFILE\Downloads"
will take you to the user's Downloads folder (given that it's named "Downloads").]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With