Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

running cscript.exe in silent mode?

12,135 views
Skip to first unread message

Totoro

unread,
May 8, 2000, 3:00:00 AM5/8/00
to
Hi,

does anyone here know how to make the csript.exe run in silent mode? I have
to run a script using cscript.exe from a setup program, but it always comes
up with a DOS prompt. Thanks!

- Emily Chang

Michael J. Carter

unread,
May 8, 2000, 3:00:00 AM5/8/00
to
I'm not sure if this is what you're looking for, but this should prevent
cscript from displaying any output:

cscript //b //nologo "scriptname"

If you want to prevent a DOS window from opening when your run it, then you
need to deal with that in your setup application (for example, launching an
application in a hidden window). You could do this in WSH:

' Run script in invisible window and wait until script is complete
WSShell.Run "cscript //b //nologo myscript.vbs", 0, True

Hope this helps.

Michael


"Totoro" <emil...@yahoo.com> wrote in message
news:ehXQKkUu$GA.259@cppssbbsa05...

Walter Zackery

unread,
May 8, 2000, 3:00:00 AM5/8/00
to

The trick to running cscript without a Dos prompt is to first launch
the script with *wscript.exe* and then force cscript, which you can
then run hidden. You have to be careful to pass any script arguments
exactly as they were first passed to wscript.exe. You also have to be
sure to quit the wscript instance upon launching cscript. Here is a
jscript sample that demonstrates a means of doing this.

var Shell = new ActiveXObject("WScript.Shell");
var ScriptPath = 'cscript "' + WScript.ScriptFullName + '" '
if(WScript.FullName.toLowerCase().indexOf("wscript.exe") >-1)
{
var Arguments = new String();
for(var Arg = 0; Arg < WScript.Arguments.Length; Arg++)
{
WScript.Arguments(Arg).indexOf(" ") == -1 ?
Arguments += WScript.Arguments(Arg) + " " :
Arguments += '"' + WScript.Arguments(Arg) + '" '
}
Shell.Run(ScriptPath + Arguments,0)
WScript.Quit();
}
///Place remainder of script here, which will now be running
///under an hidden instance of cscript.exe.

:
:

0 new messages