Get OneDrive path in Windows

2019-05-08 03:37发布

I have a C# WPF application and I am trying to find a way to get the path to the root OneDrive directory in Windows. How can I do this programmatically? I have searched online, but I couldn't find anything. I wish I could supply some code but I have no clue; I mean, I have checked system environment variables and I couldn't find anything on my machine, thinking that could be a valid solution, but it didn't turn up anything.

7条回答
走好不送
2楼-- · 2019-05-08 04:15

You must find path under registry ... First run regedit from search box , then under Software - Microsoft - find OneDrive image description here

Then use that path for you subkey string

const string subkey = @"Software\Microsoft\OneDrive";

Solution source code is here

查看更多
登录 后发表回答