Skip to content

Instantly share code, notes, and snippets.

@mttaggart
Last active September 23, 2023 20:15
Show Gist options
  • Save mttaggart/eb2ba020b8816cfe3da4cfd835240b7d to your computer and use it in GitHub Desktop.
Save mttaggart/eb2ba020b8816cfe3da4cfd835240b7d to your computer and use it in GitHub Desktop.
make-lnk.ps1
param ( [string]$SourceExe, [string]$DestinationPath, [string]$IconPath)
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
$Shortcut.RelativePath = "..\..\..\..\..\..\..\..\..\$SourceExe"
$Shortcut.IconLocation = $IconPath
$Shortcut.TargetPath = $SourceExe
$Shortcut.Save()
@mttaggart
Copy link
Author

This script is shared for educational purposes only, in the hope that seeing this kind of abuse of .lnk files will improve defenses against it. Do not do crimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment