gpt4 book ai didi

powershell - 使用 Powershell 编辑快捷方式 (.lnk) 属性

转载 作者:行者123 更新时间:2023-12-03 08:20:49 26 4
gpt4 key购买 nike

我找到了一种讨厌的 VBS 方法来执行此操作,但我正在寻找一个本地 PoSh 程序来编辑 .LNK 文件的属性。目标是联系远程机器,复制具有大多数正确属性的现有快捷方式,并编辑其中的几个。

如果编写新的快捷方式文件更容易,那也可以。

最佳答案

Copy-Item $sourcepath $destination  ## Get the lnk we want to use as a template
$shell = New-Object -COM WScript.Shell
$shortcut = $shell.CreateShortcut($destination) ## Open the lnk
$shortcut.TargetPath = "C:\path\to\new\exe.exe" ## Make changes
$shortcut.Description = "Our new link" ## This is the "Comment" field
$shortcut.Save() ## Save

在此处找到代码的 VB 版本:
http://www.tutorialized.com/view/tutorial/Extract-the-target-file-from-a-shortcut-file-.lnk/18349

关于powershell - 使用 Powershell 编辑快捷方式 (.lnk) 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/484560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com