用vbscript实现隐藏任务栏图标的脚本

时间:2021-05-22

Message="Toworkcorrectly,thescriptwillclose"&vbCR
  Message=Message&"andrestarttheWindowsExplorershell."&vbCR
  Message=Message&"Thiswillnotharmyoursystem."&vbCR&vbCR
  Message=Message&"Continue?"
  X=MsgBox(Message,vbYesNo,"Notice")
  IfX=6Then
  OnErrorResumeNext
  DimWSHShell,n,MyBox,p,t,errnum,vers
  Dimitemtype
  Dimenab,disab,jobfunc
  SetWSHShell=WScript.CreateObject("WScript.Shell")
  p="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayItemsDisplay"
  itemtype="REG_DWORD"
  enab="ENABLED"
  disab="DISABLED"
  jobfunc="NotificationIconsarenow"
  t="Confirmation"
  Err.Clear
  n=WSHShell.RegRead(p)
  errnum=Err.Number
  iferrnum<>0then
  WSHShell.RegWritep,0,itemtype
  EndIf
  Ifn=0Then
  n=1
  WSHShell.RegWritep,n,itemtype
  Mybox=MsgBox(jobfunc&disab&vbCR,4096,t)
  ElseIfn=1then
  n=0
  WSHShell.RegWritep,n,itemtype
  Mybox=MsgBox(jobfunc&enab&vbCR,4096,t)
  EndIf
  SetWshShell=Nothing
  OnErrorGoTo0
  ForEachProcessinGetObject("winmgmts:")._
  ExecQuery("select*fromWin32_Processwherename='explorer.exe'")
  Process.terminate(0)
  Next
  MsgBox"Finished."&vbcr&vbcr,4096,"Done"
  Else
  MsgBox"Nochangesweremadetoyoursystem."&vbcr&vbcr,4096,"UserCancelled"
  EndIf

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章