Hello everyone,
I'm writing a C program which sends a command to cmd.exe.
I have an executable I need to run and send parameters too. I am trying to make the program more portable, so I am trying to allow spaces to be in the filepath where the executable is located.
I have successfully solved that issue by enclosing the filepath in quotes. Below is an example of the command I send:
cmd.exe /c "c:\File path with spaces\executable" -k unlock
This works great but now an issue arises when I have to send a parameter to this executable which includes empty quotation marks as shown here:
cmd.exe /c "c:\File path with spaces\executable" -k unlock ""
This does not work, yet it works when I remove the quotations around the file path, but then the only issue is that there can't be spaces in the file path:
cmd.exe /c c:\Filepathwithoutspaces\executable -k unlock ""
Does anyone know why this happens? How can I resolve this?
Thanks!