Python 定位桌面
通过注册表寻找桌面路径:
(用内置的winreg)
import winreg
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, \
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', )
cwd= winreg.QueryValueEx(key, "Desktop")[0]
print(cwd)
通过注册表寻找桌面路径:
(用内置的winreg)
import winreg
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, \
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', )
cwd= winreg.QueryValueEx(key, "Desktop")[0]
print(cwd)