作者bero (bero)
看板C_Sharp
标题Re: [问题] 逸散字元是否能够不用呢?
时间Sun Dec 20 01:20:29 2009
部分原始码:
private void button1_Click_1(object sender, EventArgs e)
{
Process.Start("C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\
powershell.exe", test.Text);
}
test为richtextbox
内容为
@"
function aa{
"hello world"
}
aa
read-host
"
hello world两边的"如果不改成\"
那powershell就会跑失败...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.73.237.242
1F:推 kyoin:要改成这样 ""hello world"" 12/20 01:26
2F:→ bero:可是这样就要动到我原本的script档呀...希望可以完全不用改 12/20 01:32
3F:→ bero:毕竟改\"跟改""对於後续要修改script都会造成一定程度的障碍 12/20 01:34
4F:推 kyoin:请问一下你在Button_click得到的test.text是你自己输入在 12/20 01:47
5F:→ kyoin:richtextbox的值吗? 12/20 01:48
6F:→ bero:是的...是在visual studio里面打的,不是编译好执行时打的 12/20 15:42
7F:推 evirtues:试试test.Text.Replace("\"", "\\\"") 12/20 22:09