注册表项中的根无效 (VBScript)

问题描述 投票:0回答:2

我制作了一个简单的 VBScript 文件来启用任务管理器。 但是当我执行它时,我收到错误“注册表项中的根无效” 为什么?

set Shell=CreateObject("Wscript.Shell")
shell.regwrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Microsoft\Windows\System\DisableTaskMgr","0","REG_DWORD"
vbscript
2个回答
1
投票

将此添加到 WScript.Shell 下面的代码中:

RunAsAdmin()
Function RunAsAdmin()
    If WScript.Arguments.length = 0 Then
        CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & _
        WScript.ScriptFullName & """" & " RunAsAdministrator",,"runas", 1
        WScript.Quit
    End If
End Function

这将以管理员身份运行脚本。如果它不起作用,请检查您的注册表路径,因为它可能不正确。


0
投票

该解决方案导致此错误=>“需要对象”

请帮忙解决问题...

谢谢...

© www.soinside.com 2019 - 2024. All rights reserved.