Home > Mobile >  How to change location of Windows desktop folder in C# (.NET Core)?
How to change location of Windows desktop folder in C# (.NET Core)?

Time:10-08

This can be done manually in windows by right clicking the current desktop folder, clicking on properties and selecting the location tab from the context menu.

I am guessing the path to the desktop needs to be stored somewhere, however I have no idea where to start looking.

CONTEXT: I am making a tool that would allow me to have different icons and files on each virtual desktop. I have already tried moving all files in the folder instead of the folder itself but that unfortunately doesn't suit my needs.

CodePudding user response:

You can change your desktop folder through the Registry, it's located under: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders The key name is: Desktop

I hope this answers your question.

EDIT: In C# you can use https://www.pinvoke.net/default.aspx/shell32.SHSetKnownFolderPath to change Desktop folder and then reload with F5 or with a script.

  • Related