.VBS直接运行创建快捷方式的代码参考,先在CMD中执行cmd /e:on开启CMD命令扩展:
.bat中创建快捷方式的代码:
| Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") '特殊文件夹“桌面” set oShellLink = WshShell.CreateShortcut(strDesktop & "\SecureCRT 8.7.3.lnk") '在桌面创建一个快捷方式 oShellLink.TargetPath = "%~dp0\SecureCRT.exe" '目标 oShellLink.WindowStyle = 1 '参数1默认窗口激活,参数3最大化激活,参数7最小化 'oShellLink.Hotkey = "Ctrl+Alt+e" '快捷键,一般不需要设置 'oShellLink.IconLocation = "%~dp0\SecureCRT.exe, 0" '图标,一般不需要设置 oShellLink.Description = "SecureCRT 8.7.3" '备注 oShellLink.WorkingDirectory = "%~dp0" '起始位置 oShellLink.Save '保存快捷方式参数 |
.bat中创建快捷方式的代码:
| @echo off cmd /e:on //开启cmd命令扩展,否则下面的%~dp0本目录命令无法获取 (echo Set WshShell=CreateObject("WScript.Shell"^) echo strDesKtop=WshShell.SpecialFolders("DesKtop"^) '特殊文件夹“桌面” echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\SecureCRT 8.7.3.lnk"^) '在桌面创建一个快捷方式 echo oShellLink.TargetPath="%~dp0\SecureCRT.exe" '目标 echo oShellLink.WorkingDirectory="%~dp0" '起始位置 echo oShellLink.WindowStyle=1 '1默认窗口,3最大化,7最小化 echo oShellLink.Description = "SecureCRT 8.7.3" '备注 echo oShellLink.Save '保存快捷方式的设置 echo Set oShellLink1=WshShell.CreateShortcut(strDesKtop^&"\SecureFX 8.7.3.lnk"^) echo oShellLink1.TargetPath="%~dp0\SecureFX.exe" echo oShellLink1.WorkingDirectory="%~dp0" echo oShellLink1.WindowStyle=1 echo oShellLink1.Description = "SecureFX 8.7.3" echo oShellLink1.Save)>makelnk.vbs makelnk.vbs del /f /q makelnk.vbs |
文章来源:
网络小编D
版权声明:
本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系本站立刻删除。
