如何为 Internet Explorer 创建 URL 快捷方式

Tyl*_*r S 4 powershell internet-explorer shortcut

我有一个 PowerShell 脚本,可以在 Internet Explorer 中打开某个链接。到目前为止我有以下代码。它会打开链接,但当我特别需要在 Internet Explorer 中打开它时,它会发送到我的默认浏览器。

$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut($env:USERPROFILE + "\Desktop\TMW.lnk")
$ShortCut.TargetPath="http://tmw1.casttrans.com/rdweb"
$ShortCut.WorkingDirectory = "C:\Program Files (x86)\Internet Explorer";
$ShortCut.WindowStyle = 1;
$ShortCut.IconLocation = "iexplore.exe, 0";

$ShortCut.Save()
Run Code Online (Sandbox Code Playgroud)

Ben*_*enH 5

URL 快捷方式使用默认浏览器打开。要使用特定浏览器打开,您需要调用该应用程序并向其传递网页。特别是,iexplore.exe打开第一个参数中传递的网页。

$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut($env:USERPROFILE + "\Desktop\TMW.lnk")
$ShortCut.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
$ShortCut.Arguments = "http://tmw1.casttrans.com/rdweb"
$ShortCut.WorkingDirectory = "C:\Program Files (x86)\Internet Explorer"
$ShortCut.WindowStyle = 1
$ShortCut.IconLocation = "iexplore.exe, 0"

$ShortCut.Save()
Run Code Online (Sandbox Code Playgroud)