且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

vbs学习笔记2——创建桌面快捷方式

更新时间:2022-09-21 17:52:09

脚本

vbs学习笔记2——创建桌面快捷方式
Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\xxx系统.lnk")

Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")        
If fso.folderExists("C:\\Program Files (x86)") Then '通过目录来判断是32位还是64位操作系统        
    oShellLink.TargetPath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" '目标
    oShellLink.WorkingDirectory = "C:\Program Files (x86)\Google\Chrome\Application\" '起始位置
Else 
    oShellLink.TargetPath = "C:\Program Files\Google\Chrome\Application\chrome.exe" 
    oShellLink.WorkingDirectory = "C:\Program Files\Google\Chrome\Application\"     
End If
oShellLink.Arguments = "http://192.168.0.1:8080/xxx/" '运行参数
oShellLink.WindowStyle = 1 '参数1默认窗口激活,参数3最大化激活,参数7最小化
oShellLink.Hotkey = "" '快捷键
oShellLink.IconLocation = "C:\Program Files\ChromeStandaloneSetup\favicon.ico" '图标
oShellLink.Description = "" 
oShellLink.Save '创建保存快捷方式
vbs学习笔记2——创建桌面快捷方式

 

 

 本文转自xwdreamer博客园博客,原文链接:http://www.cnblogs.com/xwdreamer/p/3509734.html,如需转载请自行联系原作者