Get Documents Folder in PowerShell

The default PowerShell profile does not contain a variable for the Documents folder. Meanwhile Windows does not contain an environment variable for it either.

You can easily add a variable to your profile by including the following line in your profile script:

$Documents = (gp "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders").Personal

Comments

You could also do: PS > [environment]::GetFolderPath("MyDocuments")