Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active January 15, 2025 02:35
Show Gist options
  • Save mark05e/844861883c99ab3f2096eeadbca49ab8 to your computer and use it in GitHub Desktop.
Save mark05e/844861883c99ab3f2096eeadbca49ab8 to your computer and use it in GitHub Desktop.
# https://stackoverflow.com/questions/24771455/getting-the-users-documents-folder-in-powershell
[enum]::GetNames( [System.Environment+SpecialFolder] ) |
Select @{ n="Name"; e={$_}},
@{ n="Path"; e={ [environment]::getfolderpath( $_ ) }}
# simple alternative
"MyDocuments: " + [environment]::getfolderpath("MyDocuments") ;`
"Desktop: " + [environment]::getfolderpath("Desktop") ;`
"Personal: " + [environment]::getfolderpath("Personal") ;`
"DesktopDirectory: " + [environment]::getfolderpath("DesktopDirectory") ;`
"MyPictures: " + [environment]::getfolderpath("MyPictures")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment