获取windows桌面路径
Python 获取windows桌面路径
# -*- coding: utf-8 -*-
"""
@Time : 2021/7/20 11:34
@Author : Little Duo
@File : Tools.py
"""
import winreg
def winDesktopPath():
"""
获取windows桌面路径
:return:
"""
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
desktopPath = winreg.QueryValueEx(key, "Desktop")[0]
return desktopPath