Link to home
Start Free TrialLog in
Avatar of ankur3020
ankur3020

asked on

disable cmd

vbs or other possible code to disable and enable command prompt in xp and vista
SOLUTION
Avatar of Anthony2000
Anthony2000
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I re-read your request and realized that you wanted some code snippets. See attached.

' I put the following in a file called DisabledCmdPrompt.vbs
' Disable CMD Prompt
Option Explicit
Dim objShell, strRoot, strModify, strDelete
strRoot = "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\DisableCMD"
Set objShell = CreateObject("WScript.Shell")
strModify = objShell.RegWrite(strRoot,"00000001", "REG_DWORD")
if err.number <> 0 then
WScript.Echo "Error No: " & err.number & " check " & strRoot
else
wscript.Echo "Command Prompt Disabled"
end if
strModify = null
WScript.Quit
 
'''''''''''''''''''''''''''''''''''''''''''''
 
 
' I put the following in a file called EnableCmdPrompt.vbs
'Enable CMD Prompt
Option Explicit
Dim objShell, strRoot, strModify, strDelete
strRoot = "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\DisableCMD"
Set objShell = CreateObject("WScript.Shell")
strModify = objShell.RegWrite(strRoot,"00000000", "REG_DWORD")
if err.number <> 0 then
WScript.Echo "Error No: " & err.number & " check " & strRoot
else
wscript.Echo "Command Prompt Enabled"
end if
strModify = null
WScript.Quit

Open in new window