* ---------------------------------------------------------------------- * Run the command * ---------------------------------------------------------------------- This.poWshScriptExec = This.poShell.Exec( tcCMD ) * ---------------------------------------------------------------------- * Read the output of the shell command thread (STDERR) * ---------------------------------------------------------------------- DO WHILE This.poWshScriptExec.StdErr.AtEndOfStream = .F. lcString = This.poWshScriptExec.StdErr.ReadLine() IF EMPTY( lcString ) = .F. lcStdErr = lcStdErr + lcString + CARET_CHAR ENDIF WAIT '' TIMEOUT .1 ENDDO * ---------------------------------------------------------------------- * Read the output of the shell command thread (STDOUT) * ---------------------------------------------------------------------- DO WHILE This.poWshScriptExec.StdOut.AtEndOfStream = .F. lcString = This.poWshScriptExec.StdOut.ReadLine() IF EMPTY( lcString ) = .F. lcStdOut = lcStdOut + lcString + CARET_CHAR ENDIF WAIT '' TIMEOUT .1 ENDDO * ---------------------------------------------------------------------- * Check to see if the command is still running. * ---------------------------------------------------------------------- DO WHILE This.poWshScriptExec.Status = 0 WAIT WINDOW '' TIMEOUT .1 ENDDO lcRetValBuff = IIF( OCCURS( VCS_ERROR_ID_STR, lcStdErr ) = 0, ALLTRIM( STR( This.poWshScriptExec.ExitCode )), ALLTRIM( STR( VCS_FAILURE ))) + PIPE_CHAR lcRetValBuff = lcRetValBuff + lcStdErr + PIPE_CHAR + lcStdOut RETURN lcRetValBuff