|
本帖最后由 9zhmke 于 2018-7-27 16:41 编辑
试了一下,显示倒是可以了,但是没办法点击啊,你们的是否正确?
- Set WshShell=WScript.CreateObject("WScript.Shell")
- Set objShell = CreateObject("Shell.Application")
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- lnkfile="%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" '指定存放位置
- lnkfile=WshShell.ExpandEnvironmentStrings(lnkfile) '解析环境变量,还原成真实路径
- Shortcut "IE牛难骑","C:\Program Files\Internet Explorer\iexplore.exe" '建立快捷方式的名字和路径文件
- path=Left(lnkfile,InStrRev(lnkfile,""))
- name=Replace(lnkfile,path,"")
- Set objFolder = objShell.Namespace(path)
- Set objFolderItem = objFolder.ParseName(name)
- Set colVerbs = objFolderItem.Verbs
- For Each objVerb in colVerbs
- If Left(objVerb.name,2) = "附到" Then objVerb.DoIt
- Next
- Function Shortcut(Short_name,path_and_name) '为菜单创建一个快捷方式
- lnkfile=lnkfile & "" & Short_name & ".lnk" '名称
- set oShellLink = WshShell.CreateShortcut(lnkfile)
- oShellLink.TargetPath = path_and_name '目标
- oShellLink.WindowStyle = 1 '窗口样式 1默认窗口激活,参数3最大化激活,参数7最小化
- oShellLink.Hotkey = "" '快捷键
- oShellLink.IconLocation = path_and_name & ",0" '第几个图标
- oShellLink.Description = Short_name '备注
- oShellLink.WorkingDirectory = left(path_and_name,InStrRev(path_and_name,"")-1) '起始位置
- oShellLink.Arguments = "" '参数
- oShellLink.Save '保存
- End Function
复制代码 |
|