我正在编写一个创建批处理文件然后运行的应用程序:
我知道我可以创建一个批处理文件并且run it https://stackoverflow.com/questions/5519328/executing-batch-file-in-c-sharp没问题。
我想做的是:
一旦我创建了创建文件的字符串,有什么方法可以执行string作为批处理文件?
就像是
string BatchFile = "echo \"bla bla\" \n iperf -c 123 ... ... .. "
Diagnostics.Process.Start(BatchFile);
你可以运行CMD.EXE with /c作为可执行文件并将其余部分作为参数:
Process.Start("cmd.exe", "/c echo \"bla bla\" \n iperf -c 123 ... ... .. ");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)