Skip to main content

Windows LNK File Parser and Creator

Project description

WinLnks



Python library for reading and writing Windows shortcut files (.lnk).

This library can parse .lnk files and extract all relevant information from them. Parsing a .lnk file yields a LNK object which can be altered and saved again. Moreover, .lnk file can be created from scratch be creating a LNK object, populating it with data and then saving it to a file. As that process requires some knowledge about the internals of .lnk files, some convenience functions are provided.

CLI

Mainly tool has two basic commands.

Parse existed lnk file

winlnks parse [-h] filename [props [props ...]]

positional arguments:
  filename    lnk filename to read
  props       props path to read
 
optional arguments:
  -h, --help  show this help message and exit

Create new lnk file

usage: winlnks create [-h] [--target [TARGET]][--arguments [ARGUMENTS]] [--description [DESCRIPTION]] [--icon [ICON]]
                     [--icon-index [ICON_INDEX]] [--workdir [WORKDIR]] [--mode [{Maximized,Normal,Minimized}]]

optional arguments:
  -h, --help            show this help message and exit
  --target [TARGET], -t [TARGET]
			Target path
  --output [OUTPUT], -o [OUTPUT]
                        .lnk file path
  --arguments [ARGUMENTS], -a [ARGUMENTS]
                        additional arguments
  --description [DESCRIPTION], -d [DESCRIPTION]
                        description
  --icon [ICON], -i [ICON]
                        icon filename
  --icon-index [ICON_INDEX], -ii [ICON_INDEX]
                        icon index
  --workdir [WORKDIR], -w [WORKDIR]
                        working directory
  --mode [{Maximized,Normal,Minimized}], -m [{Maximized,Normal,Minimized}]
                        window mode

Examples

py winlnks.py parse C:\Temp\calc.lnk
py winlnks.py create -t C:\windows\system32\calc.exe -o C:\Temp\calc.lnk              
winlnks create -h
winlnks p C:\Temp\calc.lnk
winlnks c --target C:\windows\system32\calc.exe --output C:\Temp\calc.lnk --mode Minimized --description "calc shortcut"          

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winlnks-0.2.2.tar.gz (19.4 kB view hashes)

Uploaded Source

Built Distribution

winlnks-0.2.2-py3-none-any.whl (19.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page