2

I Have the following code for a VBScript in Windows

Dim strOutPut
Set objExecObject = objShell.Exec(MyApp.exe)
Do While Not objExecObject.StdOut.AtEndOfStream
strOutPut = strOutPut & objExecObject.StdOut.ReadLine() &  vbCrLf 
Loop

In some computers MyApp.exe (I tested manually) trows a warning. My problem is when this happens the objExecObject comes empty and the strOutPut is not populated with the thext provided by the MyApp.exe.

If I manually run MyApp.exe I see the warning and also the text that I want (Is just a warning).

So, My question is how to execute

Set objExecObject = objShell.Exec(MyApp.exe)

And ignore the warning so it still populates the variable at

strOutPut = strOutPut & objExecObject.StdOut.ReadLine() &  vbCrLf 

Thank you.

JPKI
  • 71
  • 6
  • Anyone have some suggestion? – JPKI May 10 '16 at 21:05
  • What you ask is stupid. The answer NO. You can't use an object that didn't create. There's no code to execute. Fix your computer, it's not a programming problem. –  May 10 '16 at 22:44
  • One normally specifies full paths to files so computer configuration is irrelevant. –  May 10 '16 at 22:46
  • I can execute MyApp.exe, it runs and inside of the cmd line has an error and additional information, MyApp.exe is not crashing... – JPKI May 11 '16 at 00:30
  • The code you posted can't possibly work anywhere. `MyApp.exe` needs to be in double quotes, and if the program doesn't reside in the current working directory the string must also include the path to the executable. – Ansgar Wiechers May 11 '16 at 08:03

0 Answers0