Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Starts a process hidden, inheriting permissions.
from win32com.shell import shell
import os
fileDir = os.path.dirname(os.path.realpath(__file__)) + "\\start.bat"
OPEN_NORMAL = 5
OPEN_HIDDEN = 0
a = shell.ShellExecuteEx(
# "runas" is also nice, to request admin rights before starting. See MSDN docs on ShellExecuteEx for details.
lpVerb = "open",
# Right now it just launches a batch file in the same folder as the .py file, but if you want to customize, this is probably the droid you're looking for.
lpFile = fileDir,
# Change the following to change the behaviour of the opened window. E.g. OPEN_HIDEN will run the process invisibly, while OPEN_NORMAL will just show the window. See the MSDN docs on ShellExecuteEx for details.
nShow=OPEN_HIDDEN
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment