1

I am trying to execute a file with parameters using the "system()" function in C++ on Windows, and it works as long as there are no whitespaces in the filename. For parameters, putting double quotes around the string works, but when I try the same with the executable itself, I get the following error:

"the filename,directory name, or volume label syntax is incorrect"

Does anyone know how to handle this correctly?

VolkA
  • 34,983
  • 7
  • 37
  • 37

2 Answers2

1

Use a string like this:

cmd /S /C "your entire command line string"

See: How do I deal with quote characters when using cmd.exe

Community
  • 1
  • 1
bshields
  • 3,563
  • 16
  • 16
0

It should work, look for the problem elsewhere.

Perhaps something in your flow is removing the whitespace or the double quotes from the string.

Igor
  • 26,650
  • 27
  • 89
  • 114