Pure Python COM package for Windows COM automation and interoperability
88
A utility for creating and reading Windows shortcut (.lnk) files with customizable properties.
Create shortcut files that link to target files or directories with customizable properties.
Read and extract information from existing Windows shortcut files.
@generates
def create_shortcut(shortcut_path: str, target_path: str, description: str = "", working_dir: str = "") -> None:
"""
Creates a Windows shortcut (.lnk) file.
Args:
shortcut_path: Path where the shortcut file will be created
target_path: Path to the target file or directory
description: Optional description for the shortcut
working_dir: Optional working directory for the shortcut
Raises:
ValueError: If shortcut_path or target_path is empty
OSError: If there are issues creating the shortcut file
"""
pass
def read_shortcut(shortcut_path: str) -> dict:
"""
Reads properties from an existing Windows shortcut file.
Args:
shortcut_path: Path to the shortcut file to read
Returns:
Dictionary containing:
- 'target': Target path of the shortcut
- 'description': Description property (empty string if not set)
- 'working_dir': Working directory property (empty string if not set)
Raises:
ValueError: If shortcut_path is empty
FileNotFoundError: If the shortcut file does not exist
OSError: If there are issues reading the shortcut file
"""
passProvides COM interface access for Windows Shell objects and persistence operations.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-comtypesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10