I am looking to run a subprocess and not let the subprocess be seen.
I have something like this:

proc = subprocess.call(["some.exe", "arg1", "arg2", "argN"])

The needs to be ran in the background.
I also tried something like this:

info = subprocess.STARTUPINFO()
info.dwFlags = 1
info.wShowWindow = 0
subprocess.Popen('some.exe arg1 arg2 argN', startupinfo=info)

Still no luck, any ideas?

Recommended Answers

All 7 Replies

I don't understand what you want to hide. Is it something visible on the screen, like a cmd console, or is some.exe a GUI program ?

It brings up some.exe its a GUI program.

Can't I somehow run it in the background?

Perhaps by using the start command with options such as /MIN or /B. (Note that I'm only an occasional windows user).

Member Avatar for Mouche

If you use the win32gui module, you can find the window by its title using win32gui.FindWindow() and then use win32gui.ShowWindow() to minimize it.

win32gui is here on sourceforge

will it still take focus away from my program?

Member Avatar for Mouche

I'm not sure. The new program will be out of focus since it is minimized, so the old program shouldn't have lost focus.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.