Last active
September 23, 2023 20:15
-
-
Save mttaggart/eb2ba020b8816cfe3da4cfd835240b7d to your computer and use it in GitHub Desktop.
make-lnk.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.