0

Context:

I have a VB.Net application that executes a python script. Once the script executes, the VB application captures the output and continues. The python script only executes successfully when the VB application creates a Process with CreateNoWindow = False. Note that the python script does execute a subprocess. It seems that the python subprocess cannot execute within the context of the VB application, unless a cmd window is created.

Below is how I configure the process in VB:

            ProcessObj.FileName               = "cmd.exe"
            ProcessObj.WorkingDirectory       = Directory
            ProcessObj.Arguments              = "C:"    '"dir"
            ProcessObj.RedirectStandardInput  = True
            ProcessObj.RedirectStandardOutput = True
            ProcessObj.RedirectStandardError  = True
            ProcessObj.UseShellExecute        = False
            ProcessObj.CreateNoWindow         = False

EDIT:

After doing some more simplified testing, I have reduced the issue to a simple VB.net application that creates a process that runs an executable via CMD prompt. The output of CMD prompt can only be captured with a window. If the window is not enabled, then the output to CMD prompt is lost.

Questions:

What can I do to work around the CreateNoWindow=False requirement?

Is there an alternative for executing the python script?

Why does the python script subprocess not execute?

user2899525
  • 105
  • 10
  • Please check this thread https://stackoverflow.com/questions/36830356/c-sharp-i-cant-get-createnowindow-to-work-not-even-the-msdn-com-example hope this will help you to understand how "CreateNoWindow" works! – Nikhil Sawant Feb 07 '23 at 16:44
  • Are you using vb.NET? Not VBA? – Tim Williams Feb 07 '23 at 17:18

0 Answers0