-1

so i am writing a program that can send commands to Command Promt and i need to declare a string that has my command in. However my command includes quotation marks. Here is what it currently reads. As you can see, in my variables it starts creating a new string and i just need to know how to make it into just one string.

strCmdText= "reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f";
System.Diagnostics.Process.Start("cmd.exe", strCmdText);

1 Answers1

1

use \"

strCmdText= "reg add \"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\" /v fDenyTSConnections /t REG_DWORD /d 0 /f";
Kahbazi
  • 14,331
  • 3
  • 45
  • 76