Command Prompt wont take input paths

I am writing a program to automate an .exe file that takes file paths as arguments.
Lets call this file we want to automatically call scale.exe

The Strings scalarPath, inputPath, and outputPath are all made using the function sketchPath()

My program is calls scale.exe like this:
launch(scalarPath + "scale.exe" + inputPath + " " + outputPath);

.

The issue is sketchPath() can return a result with spaces, for example:
C:\Program Files\example

The command prompt interprets said space as the end of an argument, leading to an error

How do I make command prompt interpret the full path, instead of splitting at a space?

1 Like

You probably need to escape the space character inside the string. Looks like it’s done with a caret character ^, but based on included article things are not necessarily straight forward. Anyway try to replace the space ’ ’ with '^ ’ - caret and space

2 Likes