当前位置: 移动技术网 > IT编程>脚本编程>VBScript > 用vbs操作注册表实例代码

用vbs操作注册表实例代码

2017年12月12日  | 移动技术网IT编程  | 我要评论
打开或关闭cmd:

  dim wshshell, r, m, v, t, g
dim i

on error resume next

set wshshell=wscript.createobject("wscript.shell")
v="hkey_current_user\software\policies\microsoft\windows\system\disablecmd"
i="reg_dword"
t="命令提示窗口开关"

r=wshshell.regread(v)
g=1

if (r=1) then g=0
if g=1 then
 wshshell.regwrite v,1,i
 m=msgbox("是否限制命令提示窗口?",3,t)
else
 wshshell.regdelete v
 m=msgbox("是否解除命令提示窗口限制?",3,t)
end if

  将以上内容复制到记事本中,将文件另存为*.vbs即可!

  打开或关闭注册表:

dim wshshell,r,m,v,t,g,i

on error resume next

set  wshshell=wscript.createobject("wscript.shell")
 v="hkcu\software\microsoft\windows\currentversion\policies\system\disableregistrytools"
 i="reg_dword"
 t="注册表开关"
 r=wshshell.regread(v)
 g=1

if r=1 then g=0
if g=1 then
 wshshell.regwrite v,1,i
 m=msgbox("是否限制注册表编辑器?",4,t)
else
 wshshell.regdelete v
 m=msgbox("是否解除注册表编辑器限制?",4,t)
end if

  也是将以上内容复制到记事本中,将文件另存为*.vbs即可!

  打开或关闭任务管理器:

dim wshshell, r, m, v, t, g
dim i

on error resume next

set wshshell=wscript.createobject("wscript.shell")
v="hkcu\software\microsoft\windows\currentversion\policies\system\disabletaskmgr"
i="reg_dword"
t="任务管理器开关"

r=wshshell.regread(v)
g=1

if (r=1) then g=0
if g=1 then
 wshshell.regwrite v,1,i
 m=msgbox("是否限制任务管理器?",3,t)
else
 wshshell.regdelete v
 m=msgbox("是否解除任务管理器限制?",3,t)
end if

  也是将以上内容复制到记事本中,将文件另存为*.vbs即可!

  希望大家能用上以上脚本!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网