用vbscript实现隐藏任务栏图标的脚本
程序员文章站
2022-04-29 09:17:56
message = "to work correctly, the script will ...
message = "to work correctly, the script will close" & vbcr
message = message & "and restart the windows explorer shell." & vbcr
message = message & "this will not harm your system." & vbcr & vbcr
message = message & "continue?"
x = msgbox(message, vbyesno, "notice")
if x = 6 then
on error resume next
dim wshshell, n, mybox, p, t, errnum, vers
dim itemtype
dim enab, disab, jobfunc
set wshshell = wscript.createobject("wscript.shell")
p = "hkcu\software\microsoft\windows\currentversion\policies\explorer\notrayitemsdisplay"
itemtype = "reg_dword"
enab = "enabled"
disab = "disabled"
jobfunc = "notification icons are now "
t = "confirmation"
err.clear
n = wshshell.regread (p)
errnum = err.number
if errnum <> 0 then
wshshell.regwrite p, 0, itemtype
end if
if n = 0 then
n = 1
wshshell.regwrite p, n, itemtype
mybox = msgbox(jobfunc & disab & vbcr, 4096, t)
elseif n = 1 then
n = 0
wshshell.regwrite p, n, itemtype
mybox = msgbox(jobfunc & enab & vbcr, 4096, t)
end if
set wshshell = nothing
on error goto 0
for each process in getobject("winmgmts:"). _
execquery ("select * from win32_process where name='explorer.exe'")
process.terminate(0)
next
msgbox "finished." & vbcr & vbcr , 4096, "done"
else
msgbox "no changes were made to your system." & vbcr & vbcr, 4096, "user cancelled"
end if
message = message & "and restart the windows explorer shell." & vbcr
message = message & "this will not harm your system." & vbcr & vbcr
message = message & "continue?"
x = msgbox(message, vbyesno, "notice")
if x = 6 then
on error resume next
dim wshshell, n, mybox, p, t, errnum, vers
dim itemtype
dim enab, disab, jobfunc
set wshshell = wscript.createobject("wscript.shell")
p = "hkcu\software\microsoft\windows\currentversion\policies\explorer\notrayitemsdisplay"
itemtype = "reg_dword"
enab = "enabled"
disab = "disabled"
jobfunc = "notification icons are now "
t = "confirmation"
err.clear
n = wshshell.regread (p)
errnum = err.number
if errnum <> 0 then
wshshell.regwrite p, 0, itemtype
end if
if n = 0 then
n = 1
wshshell.regwrite p, n, itemtype
mybox = msgbox(jobfunc & disab & vbcr, 4096, t)
elseif n = 1 then
n = 0
wshshell.regwrite p, n, itemtype
mybox = msgbox(jobfunc & enab & vbcr, 4096, t)
end if
set wshshell = nothing
on error goto 0
for each process in getobject("winmgmts:"). _
execquery ("select * from win32_process where name='explorer.exe'")
process.terminate(0)
next
msgbox "finished." & vbcr & vbcr , 4096, "done"
else
msgbox "no changes were made to your system." & vbcr & vbcr, 4096, "user cancelled"
end if
上一篇: VBS编程教程 (第2篇)