SHGetFolderPath Deprecated: What is alternative to retrieve path for Windows folders?

前端 未结 5 1902
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 01:13

The SHGetFolderPath() function is deprecated beginning with Windows Vista: http://msdn.microsoft.com/en-us/library/bb762181%28v=VS.85%29.aspx

What is th

5条回答
  •  无人及你
    2020-12-18 01:24

    From microsoft, the altenate is "SHGetKnownFolderPath" https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderpatha

    From my point of view, these functions are for c, c++ and similar languages. From powershell, I just read the registry: PS> cd hkcu:\Software\Microsoft\Windows\CurrentVersion\Explorer\ PS> dir

    Here peek at "Shell Folders" and "User Shell Folders".

    btw: These are for getting the values. I'd say that's fairly safe. For setting the values, better not use the registry direct, as it will ruin your day. Using the explorer -> properties of these 'directories' to move them, will also move the contents. Unfortunately, I donnot know a hook to use that in powershell.

提交回复
热议问题