![]() Here is the code for the cCONSOLE class CLASS cCONSOLE '= End of script - the cCONSOLE class code follows here ![]() '// Pause with the message "Hit enter to continue" print "Arg(" & ix & ")=" & wscript.arguments(ix)ĭim sMsg : sMsg =. '// List all the arguments on the console log ![]() '// Arguments are passed through correctly, if present ![]() '// Now we can use the Consol object to write to and read from the console '// Instantiate the console object, this automatically switches to CSCript if required To use it, include the complete class at the end of your script, and then instantiate it right at the beginning of the script. This assumes that your objective is to stream output to the console, rather than having output go to message boxes. I came across this post and went back to an approach that I used some time ago which is similar to main difference is that it uses a VBScript user-defined class to wrap all the logic for switching to CScript and outputting text to the console, so it makes the main script a bit cleaner. OWSH.Run vbsInterpreter & " //NoLogo " & Chr(34) & WScript.ScriptFullName & Chr(34) If InStr(LCase(WScript.FullName), vbsInterpreter) = 0 Then The function ForceConsole() will execute your vbs into cscript, also you have nice alias to print and scan text. You only need to force cscript instead wscript. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |