'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.taskbarpin
path
=
"HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\Taskbar\"
Const CSIDL_COMMON_PROGRAMS
=
&H17
Const CSIDL_PROGRAMS
=
&H2
Const CSIDL_COMMON_DESKTOPDIRECTORY
=
&H0
set
WshShell
=
WScript.CreateObject(
"WScript.Shell"
)
tmp
=
WshShell.RegWrite(path &
"ExplorerCommandHandler"
,
"{90AA3A4E-1CBA-4233-B8BB-535773D48449}"
)
Set
objShell
=
CreateObject(
"Shell.Application"
)
Set
objAllUsersProgramsFolder
=
objShell.NameSpace(CSIDL_COMMON_DESKTOPDIRECTORY)
'strAllUsersProgramsPath
=
objAllUsersProgramsFolder.Self.Path?
strDesktop
=
WshShell.SpecialFolders(
"Desktop"
)
'Msgbox strAllUsersProgramsPath
'Msgbox strDesktop
Set
objFolderItem
=
objAllUsersProgramsFolder.ParseName( strDesktop
+
"\TestApp.lnk"
)
Set
colVerbs
=
objFolderItem.Verbs
For Each objVerb
in
colVerbs
'Msgbox objVerb.name
'If Replace(objVerb.name, "&", "") = "打开文件所在的位置(I)" Then '
可打开文件夹
If Replace(objVerb.name,
"&"
, "
") = "
Taskbar" Then '没反应
objVerb.DoIt()
'Msgbox objVerb.name
End
if
Next
WshShell.RegDelete(path) '注释掉,手动执行Taskbar可程序和快捷方式固定到任务栏
Set
WshShell
=
Nothing
Set
objShell
=
Nothing