ShellLink plug-in

From NSIS Wiki

Author: Spaceblue (talk, contrib)


Download v1.2: (24 KB)

Download v1.1: (11 KB)


ShellLink is a NSIS plugin that allows you to read and change shell link (.lnk) files.

How to use

Make sure you have a valid path (link.lnk) to the shell link file.

DLL Functions

Get Shortcut Working Directory

ShellLink::GetShortCutWorkingDirectory link.lnk
Pop $0
$0=C:\Program Files\MyProgram

Get Shortcut Target

ShellLink::GetShortCutTarget link.lnk
Pop $0
$0=C:\Program Files\MyProgram\run.exe

Get Shortcut Arguments

ShellLink::GetShortCutArgs link.lnk
Pop $0
$0=/s /d=1

Get Shortcut Icon Location

ShellLink::GetShortCutIconLocation link.lnk
Pop $0
$0=C:\Program Files\MyProgram\run.dll

Get Shortcut Icon Index

ShellLink::GetShortCutIconIndex link.lnk
Pop $0

Get Shortcut Show Mode

ShellLink::GetShortCutShowMode link.lnk
Pop $0
$0=0    (SW_HIDE)
$0=5    (SW_SHOW)
$0=6    (SW_MINIMIZE)
$0=8    (SW_SHOWNA)
$0=9    (SW_RESTORE)

Get Shortcut Hot Keys

ShellLink::GetShortCutHotkey link.lnk
Pop $0

Get Shortcut Description

ShellLink::GetShortCutDescription link.lnk
Pop $0
$0=My Shortcut Description

Set Shortcut Working Directory

ShellLink::SetShortCutWorkingDirectory link.lnk directory
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Target

ShellLink::SetShortCutTarget link.lnk target.file
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Arguments

ShellLink::SetShortCutArgs link.lnk parameters
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Icon Location

ShellLink::SetShortCutIconLocation link.lnk icon.file
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Icon Index

ShellLink::SetShortCutIconIndex link.lnk icon_index_number
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Show Mode

ShellLink::SetShortCutShowMode link.lnk start_options
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Hot Keys

ShellLink::SetShortCutHotkey link.lnk keyboard_shortcut
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut Description

ShellLink::SetShortCutDescription link.lnk description
Pop $0
$0=0   -no errors
$0=-1  -error

Set Shortcut to Run As Administrator

ShellLink::SetRunAsAdministrator link.lnk
Pop $0
$0=0   -no errors
$0=-1  -error

Version History

  • 1.1 by Shengalts Aleksander aka Instructor (
    • code has been rewritten
    • added functions to change shell link information
    • reduced dll size 44Kb -> 4Kb
    • documentation updated
  • 1.0
    • First release of ShellLink.


Written and documented by Angelo Mandato


© 2004 Angelo Mandato

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any distribution.
Personal tools