Powershell appears after converting program to exe

Viewed 27

I've got a program that I converted to an exe file so I can releasse it. The problem is that some commands require powershell, and whenever I use powershell it pops up despite me hiding the console. I run the command like this:

command = [POWERSHELL_PATH, '-ExecutionPolicy', 'Unrestricted', 'echo test']
            process_result = subprocess.run(toggle_command_1, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                            universal_newlines=True)

When using my ide powershell does not popup, but as an exe it does. I use auto-py-to-exe to convert code to and exe. Any ideas on what I can do? Thanks

Edit: I've tried the soultions in How to run a PowerShell script without displaying a window? but it didn't work. Thanks for the suggestion though :)

1 Answers

you can try this Ref --assuming you using Pyinstaller to convert .py to .exe

python pyinstaller.py --noconsole johnScript.py
Related