C#我如何使用";用引号
本文关键字:quot 何使用 | 更新日期: 2023-09-27 18:00:08
stratInfo.Arguments = "RD /S /Q "C:'**" REG DELETE HKLM'SOFTWARE'**";
如何在引号中使用引号
引号是用于开始和结束字符串的特殊符号。如果需要在字符串中添加反斜杠('
(,则需要在它们之前添加反斜杠,如下所示:
string text = "this is a string with '"quotation marks'"";
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo stratInfo = new System.Diagnostics.ProcessStartInfo();
stratInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
stratInfo.FileName = "cmd.exe";
stratInfo.Arguments = "RD /S /Q '"C:''******'" REG DELETE HKLM''SOFTWARE''************** /f REG DELETE HKLM''SOFTWARE''********** /f REG DELETE HKLM''SOFTWARE''**************** /f reg add '"HKLM''SOFTWARE''**************'" /v *********** /t REG_DWORD /d '"1'" /f reg add '"HKLM''SOFTWARE''******************'" /v ******** /d '"1'" /t REG_DWORD /f ";
process.StartInfo = stratInfo;
process.Start();
感谢http://www.htmlescape.net/javaescape_tool.html