FPlatformProcess CreateProc - Dealing with folders that contain spaces

Hey Everyone,
I’m currently implementing an image converter into a runtime application and am trying to run a custom console command through FPlatformProcess::CreateProc
It does not work when trying to run any command through this function that contains spaces in the directory, i have tried adding to the start and end of each directory the “” character which should add a quotation mark.

FString cmdToRun = FPaths::GameContentDir() + "ImageMagick/convert.exe";
FString cmdParam = "\"" + filePath + "\"" + " -channel a - negate + channel "+ "\"" + path + "/" + filename + ".png" + "\"";
FPlatformProcess::CreateProc(*cmdToRun,*cmdParam, false, false, false, nullptr, 0, nullptr, nullptr);

I have also tried to add the %20 character with no luck.
This does work if the directory does not contain spaces.

Any help would be appreciated,
Thanks

1 Like

Hi, it’s been a while, but did you solve that problem?

Bumping because I too am running into this issue in 4.25 now.

In blueprints appending quotes worked for me.