It should be possible to retrieve the location of all "special folders" instead of hardcoding them (or assuming they are just subfolders of the user's profile folder).
FOLDERID_Downloads
FOLDERID_DocumentsLibrary
FOLDERID_CameraRoll
I understand this might be a .Net Core issue, not a PowerShell Core issue (haven't checked out the code yet).
[Environment]::GetFolderPath('Downloads')
MethodException: Cannot convert argument "folder", with value: "Downloads", for "GetFolderPath" to type "System.Environment+SpecialFolder": "Cannot convert value "Downloads" to type "System.Environment+SpecialFolder". Error: "Unable to match the identifier name Downloads to a valid enumerator name. Specify one of the following enumerator names and try again:
Desktop, Programs, MyDocuments, Personal, Favorites, Startup, Recent, SendTo, StartMenu, MyMusic, MyVideos, DesktopDirectory, MyComputer, NetworkShortcuts, Fonts, Templates, CommonStartMenu, CommonPrograms, CommonStartup, CommonDesktopDirectory, ApplicationData, PrinterShortcuts, LocalApplicationData, InternetCache, Cookies, History, CommonApplicationData, Windows, System, ProgramFiles, MyPictures, UserProfile, SystemX86, ProgramFilesX86, CommonProgramFiles, CommonProgramFilesX86, CommonTemplates, CommonDocuments, CommonAdminTools, AdminTools, CommonMusic, CommonPictures, CommonVideos, Resources,
LocalizedResources, CommonOemLinks, CDBurning""
❯ $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.6
PSEdition Core
GitCommitId 7.0.0-preview.6
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
It should be possible to retrieve the location of all "special folders" instead of hardcoding them (or assuming they are just subfolders of the user's profile folder).
As of today,
[Environment]::GetFolderPath()(which reportedly relies on SHGetKnownFolderPath()) doesn't support all KNOWNFOLDERID's. Here's a few of the ones that are not supported:I understand this might be a .Net Core issue, not a PowerShell Core issue (haven't checked out the code yet).
Steps to reproduce
Expected behavior
Actual behavior
Environment data