Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to suppres command prompt windows during insta


3 replies to this topic

Raam

Raam
  • Members
  • 12 posts

Posted 16 December 2005 - 18:14

All,

During my installation, there are a couple of places where cscript.exe is called using a command line to create virtual directories in IIS. I use LaunchAppandWait to invoke the command cscript.exe. This will bring up command prompt windows during my installation which is of annoying to the users.

How can I suppress the command prompt window and do the cscript.exe execution in silent mode?

Please help

Raam

FrankSpierings

FrankSpierings
  • Members
  • 22 posts

Posted 29 December 2005 - 16:12

Raam,

Are u unable to run the script from the internal MSI script host? (This could occur when calling the active Wscript object, which isn't used by the internal script host)
What i mean with the above is a vbs custom action. Which is a supported action for MSI.

Otherwise you could create a VBS wrapper around the command. Eg:

'---------------------------------
Const NOT_VISIBLE = 0
Const WAIT_ON_RETURN = True
Set objShell = CreateObject("Wscript.Shell") 'New shell object
objShell.Run "%COMSPEC% /C Cscript.exe myscript.vbs",NOT_VISIBLE,WAIT_ON_RETURN
'---------------------------------


Hope this helps you out.

mpento

mpento
  • Full Members
  • 38 posts

Posted 29 December 2005 - 17:35

Raam,

You can create a custom action which runs your vbscript without the need for any install script to launch it.

Go to the custom actions view, launch the CA wizard, select "Run VBScript Code" and select "Stored directly in custom action" as the location.

You can then literally paste your vbscript into the editor window when you click next and then insert it into the sequence where ever you like. I believe this will also supress the DOS windows from popping up since the script is internally handled.

Hope this helps,
Mike
Michael J. Pento

Independent InstallShield Contractor
mjpento@NO_SPAM.comcast.net

FrankSpierings

FrankSpierings
  • Members
  • 22 posts

Posted 30 December 2005 - 09:40

Mike is correct, however i already tried to say the same smile.gif I notice now that my first two lines of comment where not very clear.

But, yes theres always a but.
When using the internal MSI scripting host, like Mike described, u could get errors.

CScript is the command line version of the scripting host. Wscript is the "windowed" version.
Following script as an example:

test.vbs
-----------------------------
Wscript.echo "Hello world"
-----------------------------

When run like this:
"cscript test.vbs"
a command window will pop-up, with the text hello world.
When run like this:
"wscript test.vbs"
a message box will appear.

When run from a MSI as a vbscript custom action, like Mike described, an error will occur. The error will occur because you have tried to use an active object Wscript, which isn't available from the internal MSI scripting host. I don't know why MS chose to do this, but its a fact we have to deal with.

So thats why my advice is to use a wrapping script like my previous post, when the main script contains these kinds of calls.

Notice that:
-----------------------------
Set objShell = CreateObject("Wscript.Shell")
-----------------------------
is something completely different than the active Wscript object, since it creates a new object, by the use of COM / ActiveX

Hope this is more clear than my previous post.

Edited by FrankSpierings, 30 December 2005 - 09:41.