Python Forum
Run hidden exe - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Run hidden exe (/thread-28760.html)



Run hidden exe - samuelbachorik - Aug-02-2020

Hello dear users, iam trying to call exe. file from python and run it hidden. I want to run it without user operation. I have this script and it is working fine but when windows needs to ask this, it is not working -
116880004-1421707291368565-1292061420754641316-n


Is it possible to add something to this code to skip this or always allow to run targeted exe. ?
When i run this program and accept is needed, this program crash. When i run this program and acept is not needed it works fine.

import subprocess

def startProgram():
    SW_HIDE = 0
    info = subprocess.STARTUPINFO()
    info.dwFlags = subprocess.STARTF_USESHOWWINDOW
    info.wShowWindow = SW_HIDE
    subprocess.Popen(r"C:\Program Files\SketchUp\SketchUp 2017\SketchUp.exe", startupinfo=info)
startProgram()