Use WScript.Echo "Hello" line only (remove other lines) and start the script in console using this command: cscript test.vbs.
VBscript write to command console
Filip
831
Reputation points
Hello everybody.
Can i run .vbs file in the command line and get there printed output?
I tried :
Dim StdOut : Set StdOut = CreateObject("Scripting.FileSystemObject").GetStandardStream(1)
WScript.Echo "Hello"
WScript.StdOut.Write "Hello"
WScript.StdOut.WriteLine "Hello"
Stdout.WriteLine "Hello"
Stdout.Write "Hello"
Thanks for help.
Community Center Not monitored
46,180 questions
2 answers
Sort by: Most helpful
-
-
MotoX80 36,291 Reputation points
2021-04-20T13:44:59.073+00:00 Windows has 2 VB script processors, WScript.exe (GUI) and CScript.exe (console). To get the output to display in a command prompt you have to use cscript.exe.
cscript.exe C:\MyScriptsFolder\MyScript.vbs
If you just type in the script name Windows will use the default which is wscript.exe. You can change that from an admin command prompt.
cscript.exe //H:CScript