从命令提示符处更改快捷方式的目标 [英] Change a shortcut's target from command prompt
本文介绍了从命令提示符处更改快捷方式的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通常一个Linux的家伙,但我需要写在Windows批处理脚本改变一些快捷方式的目标。是否有一个命令做到这一点?
I'm normally a Linux guy, but I need to write a batch script on Windows to change the target of some shortcuts. Is there a command to do that?
推荐答案
我怀疑有一种方法用一个批处理脚本来做到这一点。这是在VBScript 可行,虽然。
I doubt there is a way to do it with a batch script. It's doable in VBScript, though.
Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("C:\Wherever\Shortcut.lnk")
shortcut.TargetPath = "C:\Wherever\Whatever.txt"
shortcut.Save
保存脚本中的vbs结尾的文件,并使用命令行运行它 CSCRIPT whatever.vbs
。
(不要被名称所迷惑 - CreateShortcut
用于两个创建和修改快捷方式)
(Don't be fooled by the name -- CreateShortcut
is used to both create and modify shortcuts.)
这篇关于从命令提示符处更改快捷方式的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文