Skip to content

eladshamir/CreateRelativePathShortcut

Repository files navigation

CreateRelativePathShortcut

This is a simple program that generates shortcuts (MS-SHLLINK) with relative paths

Usage

CreateRelativePathShortcut.exe 
/path:<TARGET_PATH> /args:<CMD_LINE_ARGS> /iconpath:<ICON_PATH> /iconindex:<INT> /output:<OUTPUT_PATH> /readonly

The following command line arguments are required:

  • path: The relative path of the target application
  • output: The path to save the generated shortcut

The following command line arguments are options:

  • args: Command line arguments
  • iconpath: The path of the icon file
  • iconindex: The index of the icon in the icon file
  • readonly: If present, sets the shortcut file to read-only (recommended)

Example:

CreateRelativePathShortcut.exe /path:"bin\start.exe" /args:"--quiet --force" /iconpath:"%SystemRoot%\System32\imageres.dll" /iconindex:1 /output:"Relative Path Shortcut.lnk" /readonly

Keeping It Relative

When you launch an LNK file with a relative path, Windows automatically modifies the file to point to the absolute path, making the shortcuts created by this program good for only one time use.

As a workaround, use the /readonly flag to set the generated LNK file as read-only, stopping Windows from modifying it.

Credits

This project leverages the following libraries:

About

This is a simple program that generates shortcuts (MS-SHLLINK) with relative paths

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages