Created
April 27, 2018 12:40
-
-
Save mozbugbox/03d1ee3a8c2f48c29cd7a6a65aee8e8e to your computer and use it in GitHub Desktop.
Run msys2 python3.exe without console on windows/win32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
' Run Python script with hidden/no console using MSYS2 Python3 | |
' Keywords: python msys2 windows win32 vbs gtk+ hidden console | |
' | |
' License: GNU GPL v3 or later (c) mozbugbox | |
' | |
PY_BIN = "C:\msys64\mingw64\bin\python3.exe " | |
PY_SCRIPT = WScript.Arguments.Item(0) | |
' Get Full Path of python script file | |
Set fs = CreateObject("Scripting.FileSystemObject") | |
If NOT fs.FileExists(PY_BIN) Then | |
PY_BIN = "python3.exe" | |
End If | |
PY_SCRIPT = fs.GetAbsolutePathName(PY_SCRIPT) | |
' Create process with hidden console | |
Const HIDDEN_WINDOW = 0 | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | |
Set objStartup = objWMIService.Get("Win32_ProcessStartup") | |
Set objConfig = objStartup.SpawnInstance_ | |
objConfig.ShowWindow = HIDDEN_WINDOW | |
Set objProcess = objWMIService.Get("Win32_Process") | |
objProcess.Create PY_BIN & PY_SCRIPT, null, objConfig, intProcessID | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful to run python3 Gobject Gtk+/pygtk applications on Windows.