What I have is a command which is delivered to the cmd to be executed.
string command = @"C:\Privat\Docs\programm.exe" + " " + "-k" + " " + "https://thisIsAnUrl/DoIt=" + argument;
The argument has to look like this: \"xx:xx:xx:xx\"
When I execute it with this command, I'll get the output
C:\Privat\Docs\programm.exe -k https://thisIsAnUrl/DoIt=\"xx:xx:xx:xx\"
which is working like I intend it to be.
The problem is: when the directory contains a space (C:\Privat\Do cs\programm.exe
) you would need to add quotation marks to the directory:
string command = @"""C:\Privat\Do cs\programm.exe""" + " " + "-k" + " " + "https://thisIsAnUrl/DoIt=" + argument;
The output then become "C:\Privat\Do cs\programm.exe" -k https://thisIsAnUrl/DoIt=\"xx:xx:xx:xx\"
which is working fine if I execute it directly in the cmd, but if I call the cmd via c# with this code I get an error that the command was either false written or not found (although it is correct and when i copy exactly this output and, like I said, execute it directly with cmd it is working fine).
What the cmd confuses are the \" before and after xx:xx:xx:xx but it is essential for the command to leave them
What am I missing? Please help