Windows EXE: Start Powershell instead of cmd

... if started by file explorer.
This commit is contained in:
Alexander Graf
2020-06-06 10:37:20 +02:00
parent 2fd1422619
commit 1c13d5a30b
2 changed files with 14 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ import subprocess
def __main():
with contextlib.suppress(AttributeError, psutil.Error):
if psutil.Process().parent().parent().name() == "explorer.exe":
subprocess.Popen("cmd /K \\\"{0}\\\"".format(os.path.splitext(os.path.basename(sys.argv[0]))[0]))
subprocess.Popen("powershell -NoExit -Command \\\"& {0}\\\"".format(sys.argv[0]))
return
main()