我找到了一种令人讨厌的 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 http://www.tutorialized.com/view/tutorial/Extract-the-target-file-from-a-shortcut-file-.lnk/18349
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)