I have tried to insert a dynamic string in a static string with double quote, also tried How to add double quotes to a string that is inside a variable? but nothing work in my case:
startInfo.Arguments = @"/C = """+service+""" >nul 2>&1";
service is dynamic string and i need this result:
"/C = "mystring" >nul 2>&1";
Without dynamic variable i use double quote and it work, and i need @ for static Path
"/C = ""static"" >nul 2>&1";
The verbatim string only applies to the first part because you are concetanating with +
, you can try using string interpolation:
startInfo.Arguments = $@"/C = ""{service}"" >nul 2>&1";