制作一个.lnk,可以在新窗口中使用PowerShell打开
大家好!
我希望制作PowerShell脚本,该脚本在桌面上创建.LNK快捷方式。这并不是太大了,但是当我用Chrome手动制作一个,3点>创建快捷方式时,我会得到此选项。注意如何具有“新窗口中的打开”选项。这就是我想要完成的。我该如何在新窗口中打开的桌面上制作.lnk文件?
- 在桌面上进行.lnk快捷方式将其保存到桌面
- .lnk文件在新窗口中打开 - 可以从浏览器中抓住一个图标,就像您用Chrome制作一个图标一样,因此我不必指向一个。
$Shell = New-Object -ComObject ("WScript.Shell")
$Favorite = $Shell.CreateShortcut($env:USERPROFILE + "\Desktop\Google.lnk")
$Favorite.TargetPath = "http://google.com";
$Favorite.IconLocation = "Picturelocation"
$Favorite.Arguments
$Favorite.Save()
感谢您的时间!
Good Day everyone!
I am looking to make PowerShell script that creates a .lnk shortcut on the desktop. Which isn't too big a deal, but when I make one manually with chrome, 3 dots>more tools>create shortcut I get this option. Notice how it has the "Open in a new window" option. That is what I'm looking to accomplish. How would I go about making a .lnk file on the desktop that opens in a new window?
- make an .lnk shortcut on desktop save it to desktop
- .lnk file opens in new window
-preferably grabs an icon from the browser like when you make one with chrome so I don't have to point to one.
$Shell = New-Object -ComObject ("WScript.Shell")
$Favorite = $Shell.CreateShortcut($env:USERPROFILE + "\Desktop\Google.lnk")
$Favorite.TargetPath = "http://google.com";
$Favorite.IconLocation = "Picturelocation"
$Favorite.Arguments
$Favorite.Save()
Thanks for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下内容来创建一个快捷键文件(
.lnk
),该文件在新窗口中使用给定的URL 启动Chrome :注意:上述<强>下载并分配目标网站的特定 favicon 您可以省略上面的相关代码,这将使快捷文件显示 chrome 的图标。
为了完整性:使用目标站点的favicon 创建 url 快捷文件(
.url
):请注意,此类URL快捷键文件始终:
如此答案,以编程性分配自定义图标并不直接通过
wscript.shell com对象,但可以通过 plain-text处理来实现以在事实之后修改
.url
文件,如下所示。Use the following to create a shortcut file (
.lnk
) that launches Chrome with a given URL in a new window:Note: The above downloads and assigns the target site's specific favicon as the shortcut file's icon, you can omit the relevant code above, which will make the shortcut file show Chrome's icon.
For the sake of completeness: Creating a URL shortcut file (
.url
) with the target site's favicon:Note that such URL shortcut files invariably:
As explained in this answer, assigning a custom icon programmatically isn't directly supported via the
WScript.Shell
COM object, but can be achieved via plain-text processing to modify the.url
file after the fact, as shown below.