使用VBS创建程序快捷方式

2022-07-11 22:13:20   第一文档网     [ 字体: ] [ 阅读: ] [ 文档下载 ]
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。下载word有问题请添加QQ:admin处理,感谢您的支持与谅解。点击这里给我发消息

#第一文档网# 导语】以下是®第一文档网的小编为您整理的《使用VBS创建程序快捷方式》,欢迎阅读!
快捷,创建,方式,程序,使用

使用VBS创建程序快捷方式



代码如下:



' 创建桌面快捷方式 ' 创建开始菜单启动 Option Explicit Private strDesktop Private objShellLink Private wshShell

Set wshShell = WScript.CreateObject("WScript.Shell") strDesktop = wshShell.SpecialFolders("Desktop") ' 桌面

Set objShellLink = wshShell.CreateShortcut(strDesktop& "\方向检测.lnk")

With objShellLink

.TargetPath = wshShell.CurrentDirectory& "\方向检测.exe" .WindowStyle = 4 .HotKey = "ctrl+alt+c"

'.IconLocation = wshShell.CurrentDirectory& "\wcicon.icl"


.WorkingDirectory = wshShell.CurrentDirectory .Save End With

strDesktop = wshShell.SpecialFolders("AllUsersStartup") ' 开始菜单栏启动项 Set objShellLink = wshShell.CreateShortcut(strDesktop& "\方向检测.lnk") With objShellLink

.TargetPath = wshShell.CurrentDirectory& "\方向检测.exe" .WorkingDirectory = wshShell.CurrentDirectory .Save End With

msgbox "桌面快捷方式已生成。", vbokonly+vbinformation

Set objShellLink = Nothing Set wshShell = Nothing

SpecialFolders属性

提供 WshSpecialFolders 对象,用于访问某些 Windows 外壳文件夹,例如桌面文件夹、菜单文件夹,以及个人文档文件夹等。

object.SpecialFolders(objWshSpecialFolders)

参数 object

WshShell对象。 objWshSpecialFolders 要返回的特殊文件夹的名称。

说明

如果所请求的文件夹 (strFolderName) 不可用,返回 NULL。例如,Windows 95 没有AllUsersDesktop文件夹,如果 strFolderName = AllUsersDesktop返回的将是 NULL Windows 95 Microsoft Windows NT 4.0 操作系统中提供了下列特殊文件夹: AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup Desktop Favorites Fonts

MyDocuments NetHood


PrintHood Programs Recent SendTo StartMenu Startup Templates


本文来源:https://www.dywdw.cn/3e42f86fd4d8d15abf234e2a.html

相关推荐
推荐阅读