开发者

How to get to desktop of any user by text file?

开发者 https://www.devze.com 2023-02-22 14:59 出处:网络
I have ini f开发者_开发知识库ile that I read in my program. The ini file need to contain the desktop of any user.

I have ini f开发者_开发知识库ile that I read in my program.

The ini file need to contain the desktop of any user.

How to write this?

%user%/windows?


If I understand your question correctly, try

%userprofile%\desktop


Try this code to get, in all cases, the actual desktop path :

for /f "tokens=3" %i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Desktop"') do @set desktop=%i
echo %desktop%

Actually, the desktop path can be changed. The value is stored under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop.

Do not forget to double % if you run this in a batch file.

0

精彩评论

暂无评论...
验证码 换一张
取 消