`
hmd94hmd
  • 浏览: 14743 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

利用VBS创建快捷方式

 
阅读更多

利用VBS创建快捷方式
2010年06月19日
  利用VBS创建快捷方式详细说明
  2008-07-04 20:00
  以下内容另存为 XXX.VBS
  第1个是桌面上创建快捷方式的应用范例
  Set WshShell = WScript.CreateObject("WScript.Shell")
  strDesktop = WshShell.SpecialFolders("Desktop") :'特殊文件夹“桌面”
  set oShellLink = WshShell.CreateShortcut(strDesktop & "\计算器.lnk")
  oShellLink.TargetPath = "C:\Windows\System32\Calc.exe" : '目标
  oShellLink.WindowStyle = 3 :'参数1默认窗口激活,参数3最大化激活,参数7最小化
  oShellLink.Hotkey = "Ctrl+Alt+C" : '快捷键
  oShellLink.IconLocation = "C:\Windows\System32\Calc.exe" : '图标
  oShellLink.Description = "系统默认计算器" : '备注
  oShellLink.WorkingDirectory = strDesktop : '起始位置
  oShellLink.Save : '创建保存快捷方式
  第2个是自定义目录位置上创建快捷方式的应用范例
  Set WshShell = WScript.CreateObject("WScript.Shell")
  set oShellLink = WshShell.CreateShortcut("C:\Documents and Settings\Administrator\计算器调试.lnk")
  oShellLink.IconLocation = "C:\Documents and Settings\Administrator\Calc.exe" : '图标
  oShellLink.TargetPath = "C:\Documents and Settings\Administrator\Calc.exe" : '目标
  oShellLink.WorkingDirectory = "C:\Documents and Settings\Administrator\" : '起始位置
  oShellLink.Hotkey = "Ctrl+Alt+C" : '快捷键
  oShellLink.WindowStyle = 3 :'运行方式,参数1默认窗口激活,参数3最大化激活,参数7最小化
  oShellLink.Description = "系统默认计算器" : '备注
  oShellLink.Save : '创建保存快捷方式
  以下内容另存为 XXX.js
  第3个是自定义目录位置上以JS类创建快捷方式的应用范例
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  var shl = WScript.CreateObject("WScript.Shell");
  var oUrl = shl.CreateShortcut("C:\Documents and Settings\Administrator\Favorites\\游戏菜单.lnk");
  oUrl.TargetPath = "E:\\nbmsclient\\BarClientView.exe";
  oUrl.IconLocation = "E:\\nbmsclient\\BarClientView.exe";
  oUrl.WorkingDirectory = "E:\\nbmsclient";
  oUrl.Save();
  从以上VBS和JS脚本对比我们可以发现有共同点之处,此类脚本开始都要声明以下内容以什么程序来解析运行,声明好了,接下去才是具体的步骤.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics