Skip to content

Instantly share code, notes, and snippets.

@kumekay
Created February 20, 2019 12:45
Show Gist options
  • Save kumekay/727a132f48eeea83abf313bae122abd6 to your computer and use it in GitHub Desktop.
Save kumekay/727a132f48eeea83abf313bae122abd6 to your computer and use it in GitHub Desktop.
import ctypes
from ctypes import wintypes, windll
CSIDL_LOCAL_APPDATA = 28
_SHGetFolderPath = windll.shell32.SHGetFolderPathW
_SHGetFolderPath.argtypes = [wintypes.HWND,
ctypes.c_int,
wintypes.HANDLE,
wintypes.DWORD, wintypes.LPCWSTR]
path_buf = wintypes.create_unicode_buffer(wintypes.MAX_PATH)
result = _SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, 0, path_buf)
print path_buf.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment