How to run Windows Commands from my JUCE GUI?

Hello Everyone

I am trying to run a python program from my GUI in JUCE.
I tried using system(“python”)
but it didnt work.

I also tried returning the current directory using File::getCurrentWorkingDirectory().getFullPathName()
then combining it with my python program path. It still didnt work.

Thank You

AFAIK, the best way to do this in JUCE would be to use juce::ChildProcess (

I hope this helps!

1 Like

Thank You so much :smiley: , Yeah this seems much more simpler then running through system()

ChildProcess is good if you want to keep track of execution. If you simply want to start a program, there is also file.startAsProcess() and file.revealToUser() to open an application.

startAsProcess() is very handy, because it will call the installed viewer, if called on a document file (e.g. foo.pdf would open Preview on OSX and acrobat reader on windows (or whichever pdf viewer is installed).

1 Like

??? I thought this just opened a Finder/Explorer window showing the file or folder.

1 Like

Daniel had a typo probably… :slight_smile: Bet he was speaking of;


Launches the file as a process.

if the file is executable, this will run it.
if it's a document of some kind, it will launch the document with its default viewer application.
if it's a folder, it will be opened in Explorer, Finder, or equivalent.
1 Like