shlobj module

This module wraps the SHGetKnownFolderPath function in shell32.dll and defines the necessary contstants. Known folder ids provide a unique system-independent way to identify special folders used frequently by applications, but which may not have the same name or location on any given system. For example, the system folder may be “C:Windows” on one system and “C:Winnt” on another.

class shlobj.FolderId(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Contains guids of known folders from Knownfolders.h. Full list is availabe at: https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid

ROAMING_APP_DATA = '{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}'

The file system directory that serves as a common repository for application-specific data. A typical path is C:Documents and SettingsusernameApplication Data.

LOCAL_APP_DATA = '{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}'

The file system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:Documents and SettingsusernameLocal SettingsApplication Data.

PROGRAM_DATA = '{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}'

The file system directory that contains application data for all users. A typical path is C:Documents and SettingsAll UsersApplication Data. This folder is used for application data that is not user specific.

SYSTEM = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}'
SYSTEM_X86 = '{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}'
_generate_next_value_(start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

_new_member_(**kwargs)

Create and return a new object. See help(type) for accurate signature.

_use_args_ = True
_member_names_ = ['ROAMING_APP_DATA', 'LOCAL_APP_DATA', 'PROGRAM_DATA', 'SYSTEM', 'SYSTEM_X86']
_member_map_ = {'LOCAL_APP_DATA': FolderId.LOCAL_APP_DATA, 'PROGRAM_DATA': FolderId.PROGRAM_DATA, 'ROAMING_APP_DATA': FolderId.ROAMING_APP_DATA, 'SYSTEM': FolderId.SYSTEM, 'SYSTEM_X86': FolderId.SYSTEM_X86}
_value2member_map_ = {'{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}': FolderId.SYSTEM, '{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}': FolderId.ROAMING_APP_DATA, '{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}': FolderId.PROGRAM_DATA, '{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}': FolderId.SYSTEM_X86, '{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}': FolderId.LOCAL_APP_DATA}
_unhashable_values_ = []
_member_type_

alias of str

_value_repr_()

Return repr(self).

shlobj.SHGetKnownFolderPath(folderGuid: FolderId | str, dwFlags: int = 0, hToken: int | None = None) str

Wrapper for SHGetKnownFolderPath which caches the results to avoid calling the win32 function unnecessarily.