0

I want to run .exe files hidden in Windows using Python. I used the following commands,but the hidden program does not run.

from subprocess_maximize import Popen

Popen(r"C:\Apps\test.exe",show='hidden', priority=1)
2
  • Hidden console or hidden window? Commented Jul 17, 2022 at 11:22
  • hidden window... Commented Jul 17, 2022 at 11:28

1 Answer 1

2

if you want python hide cmd console Use :

import win32gui, win32con

hide = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hide , win32con.SW_HIDE)

or if you want to hide cmd from python use :

import ctypes
ctypes.windll.user32.ShowWindow( ctypes.windll.kernel32.GetConsoleWindow(), 6 )

Else Save the program with a .pyw extension and now it will open with pythonw.exe No shell or cmd window

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks... But I want, for example, if the psiphon program runs, its window will be hidden

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.