run administrator in windows terminal code example

Example 1: run cmd as administrator command line

powershell -command "start-process cmd -verb runas"

Example 2: how to activate administrator account in windows 10 command prompt

net user administrator /active:yes

Example 3: how to run cmd run administrator using script

Set objShell = CreateObject(“Shell.Application”)
Set objWshShell = WScript.CreateObject(“WScript.Shell”)
Set objWshProcessEnv = objWshShell.Environment(“PROCESS”)

objShell.ShellExecute “C:\Windows\system32\cmd.exe”, “/k”, “”, “runas”