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.
精彩评论