How to Deal With Spaces in File Paths

Hello! I am attempting to launch a batch script from processing using the launch() command. After much experimentation I got it to work but I now need to make it user friendly. I am asking the user to find their own install of ffmpeg to run.

void setup(){
     selectInput("Please find ffmpeg.bat", "launchStuff");

void launchStuff(File file){
     String filePath = file.getPath();
     launch("cmd /c start /w " + filePath);

The problem is that ffmpeg tends to download in Program Files (on Windows), which means that there are spaces in the file path. This causes the error "C:/Program" cannot be found. How do I deal with these spaces?

Thank you!


Sign In or Register to comment.