VBScript: redirecting output from command line with arguments.Set oExec WshShell.Exec(CommandLine). In a script running from the command line, Id simply say "wscript.quit". How does one make a VBScript print to the command line without invoking Cscript before the script.vbs?I went through all of the options for intWindowStyle in the Run method of the WshShell object and none of them kept the spawned console open for more than a flash. Youll be auto redirected in 1 second.The following VBScript code opens a copy of the currently running script with Notepad.Set WshShell WScript.CreateObject("WScript.Shell") Return WshShell. Run("notepad " WScript.ScriptFullName, 1, true). Dim WshShell, oExec Set WshShell WScript.CreateObject("WScript.Shell") Set oExec WshShell.Exec("C:snmpget -c public -v 2c 10.1.1.
1.5.1") xAny suggestions? Thanks. You can redirect output to a file and then read the file Summary. The purpose of this article is to describe how to redirect command-line output by way of Windows Scripting Host (WSH) in VBScript (.vbs) and JScript (.js).Dim WshShell Dim fso Dim src, dest. Redirecting output to a file. (too old to reply).Dim WshShell Set WshShell WScript.CreateObject("WScript.Shell") WshShell.Run "C:tests.txt". And say the file doesnt exist, how do I get the error that comes up to be written to a file and not display to the user? I know there are a few answers to this already but I am unsure why the answers are not working. I will list what I have done. Basically I want to log information from a shell. Run command into a log file. What I have.