Jump to content

Execute After - Do not wait for CMD to compelete


Recommended Posts


Is it possible to have WPI run a script during the Execute after phase,

Yes.

and not wait for the script/cmd to complete?

Why don't wait the cmd isexecuted?

I know i can use Execute after, which I am doing, but I need WPI to exit and not wait for the script to complete.

The reason why, is I have a script which prompts to run another set of WPI (different confg file), it prompts yes or No

If yes, it runs WPI, if No it just exits

If WPI is still running when you select Yes, then you get an error about multiple copies of WPI running at once.

So I need WPI to run the script, and then exit, so if Yes is chosen, then the new run of WPI can start up without error.

Link to comment
Share on other sites

I know i can use Execute after, which I am doing, but I need WPI to exit and not wait for the script to complete.

The reason why, is I have a script which prompts to run another set of WPI (different confg file), it prompts yes or No

Why not ask the question directly?

Maybe you can attach your command?

I don't know if it's possible to do like you want.

Edited by myselfidem
Link to comment
Share on other sites

This is the script:

x = MsgBox("Run WPI Layer 2 Now?",4,"Windows Post Installer Layer 2")

If x = "6" Then
Return = WshShell.Run ("C:\ImgSW\wpi\WPI.exe options=useroptions_layer2.js config=config_layer2.js",1,TRUE)
ElseIf x = "7" Then
x = MsgBox("Shutdown this server?",4,"Shutdown")
If x = "6" Then
Return = WshShell.Run ("CMD /c shutdown /s /t 15",1,FALSE)
End If
End If

Wscript.Quit

I would like WPI to run this script, and then exit.

I can get around it by using a batch script, but it is ugly and I would really prefer not to do it that way.

Edited by Dragonsys
Link to comment
Share on other sites

Maybe you can use a vbs script to hide the command batch prompt, like this(example and adapt to your needs):


' Hide the batch file (clean.cmd)

Set WshShell = WScript.CreateObject("WScript.Shell" )
WshShell.Run "%SystemRoot%\Setup\Scripts\clean.cmd" ,SH_WIDE ,true

HTH

Link to comment
Share on other sites

Maybe you can use a vbs script to hide the command batch prompt, like this(example and adapt to your needs):


' Hide the batch file (clean.cmd)

Set WshShell = WScript.CreateObject("WScript.Shell" )
WshShell.Run "%SystemRoot%\Setup\Scripts\clean.cmd" ,SH_WIDE ,true

HTH

I'm not worried about showing/hiding the CMD Window, but using 1 script (WPI) to kick off another script (bat file) which kicks off another script (prompt) is just more complicated than it should be.

Guess I will just have to do it that way though... thanks for your help

Ok, i got around this by adding a sleep to my script. This gives WPI time to exit before the next session is started

Edited by Dragonsys
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...