当前位置:  开发笔记 > 后端 > 正文

从命令提示符更改快捷方式的目标

如何解决《从命令提示符更改快捷方式的目标》经验,为你挑选了2个好方法。

我通常是一个Linux人,但我需要在Windows上编写一个批处理脚本来改变一些快捷方式的目标.有命令这样做吗?



1> Tmdean..:

我怀疑有一种方法可以使用批处理脚本.不过,这在VBScript中是可行的.

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用于创建和修改快捷方式.)



2> 小智..:

没有Windows的本机程序来实现这一目标.我不久前在互联网上搜索了同样的功能,并偶然发现了自由软件XXMKLINK.

使用XXMKLINK,您可以编写用于软件安装的批处理文件,该文件由专门的安装程序完成.基本上,XXMKLINK是从命令行收集信息并将其打包成快捷方式.

XXMKLINK的命令语法:

xxmklink spath opath [ arg [ wdir [ desc [ mode [ icon[:n] ]]]]]

where 

  spath     path of the shortcut (.lnk added as needed)
  opath     path of the object represented by the shortcut
  arg       argument string (use quotes with space, see below)
  wdir      path of the working directory (for "Start in")
  desc      description string (shown in Shosrtcut's Properties)
  mode      display mode (1:Normal [default], 3:Maximized, 7:Minimized)
  icon[:n]  icon file [with optional icon index value n]

  In addition to the above, the following switches are supported
  which can be placed in any position in the command line.

  /p        prompts before action
  /q        no output when successful (quiet)
  /e        checks error condition strictly

缺点是您需要使用批处理脚本将xxmklink exe复制到每台计算机上.

链接页面底部提供了下载链接.

推荐阅读
mobiledu2402852357
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有