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 '创建保存快捷方式

 

 

 

 

 

 

你可能感兴趣的:(学习笔记)