我有以下字符串,我想将其作为一个进程执行:
Rundll32 Printui.dll,PrintUIEntry/ia/K/q/m "SHARP MX-5500N PS"/h "Windows NT x86"/v 3/f sn0hwenu.inf
但是,考虑到引号的存在,我无法在 C# 中插入此字符串以使其编译,同时保留所有原始结构。我应该如何解决这个问题?这有点棘手,因为字符串中有引号。
最佳答案
string whatever = "Rundll32 Printui.dll,PrintUIEntry /ia /K /q /m \"SHARP MX-5500N PS\" /h \"Windows NT x86\" /v 3 /f sn0hwenu.inf";
或
string whatever = @"Rundll32 Printui.dll,PrintUIEntry /ia /K /q /m ""SHARP MX-5500N PS"" /h ""Windows NT x86"" /v 3 /f sn0hwenu.inf";
关于c# - 如何使用里面有引号的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5540701/