Trying_hard
Trying_hard

Reputation: 9501

Start GUI application using subprocess

I am trying to open a file through python that once it is open takes you to a GUI. The link works fine when i just click on it and python seems to locate the file and open it, but the GUI doesn't appear. Please help. This is whay i have been using.

import subprocess
subprocess.Popen("C:/full/path")

I get no track back errors, but the GUI doesn't appear. Thoughts of how I can get it to appear, or what the problem might be?

Thanks

Upvotes: 0

Views: 3609

Answers (1)

Stefan Paul Noack
Stefan Paul Noack

Reputation: 3734

The file you're trying to 'start' is a cmd script. Use this code:

subprocess.Popen("cmd.exe /k C:\full\path\to\file.cmd")

.cmd files are not executable by themselves - you need to invoke cmd.exe to execute them. This is also what windows does when you double-click the file on the desktop.

Upvotes: 3

Related Questions