How can I exec a command as WScript cannot be used in AI - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

How can I exec a command as WScript cannot be used in AI

I want to achieve this in a CA as anything with terminal output just gets lost is I use the WsShell.Run method: -

'************************************************************
' Subroutine: ExecuteWithTerminalOutput
'
' Description:
' Execute a command from the shell and wait for it to finish.
' It also captures output properly.
'
' Parameters: strFilePath File to run.
' strWorkingDirectory Directory to run command in.
'
' Notes: Use this when using e.g. (DOS) redirected output to file.
'************************************************************

Function ExecuteWithTerminalOutput(cmd)
Dim sh
Dim exec

Set sh = WScript.CreateObject("WScript.Shell")
Set exec = sh.Exec(cmd)
Do While exec.Status = 0
WScript.Sleep 100
WScript.StdOut.Write(exec.StdOut.ReadLine())
WScript.StdErr.Write(exec.StdErr.ReadLine())
Loop
ExecuteWithTerminalOutput = exec.Status
End Function
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How can I exec a command as WScript cannot be used in AI

Hello,

Here's a similar older thread that may help you with this.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: How can I exec a command as WScript cannot be used in AI

Yes thanks. It did help.

John

Return to “Common Problems”