What you are looking for is cscript
. By just executing a vbs script file, output gets sent to dialog boxes, which need your interaction.
Using cscript
, the desired output gets printed to your current stdout:
cscript C:\Windows\System32\slmgr.vbs /ato
That doesn't have anything to do with UAC and you might consider re-activating it.
But why is that?
slmgr
is not a command nor is it an executable in windows. It's a script file written in VBScript. VBScript is a kind-of scripting version of VB, So it's good for your peace of mind not to deal with it too much.
If you type in slmgr /skms
, what windows does is looking for a file named slmgr in its search paths (%PATH%
), finding C:\Windows\System32\slmgr.vbs
and deciding that, as its a .vbs
file, executing wscript.exe
with the file path and your arguments as parameter is the right thing to do.
WScript is the default interpreter for vbs files and just interprets the file and executes its code. On the other hand, there is cscript
for console scripts.
If the author of the .vbs
file decides to write a message to the user of their script, they usually use a statement like
Wscript.Echo "Hello, World!"
And thats where your confusion starts:
Executing this script in cscript means that Hello, World!
is written to the console. (That's what you want to do)
Executing the same script using wscript renders a message box with a OK button. You can easily reproduce it yourself by creating a vbs file with the above statement.
The difference between cscript and wscript is also discussed in this question:
Difference between wscript and cscript