我有一个程序,我想执行以下操作:
- 获取文件(类型未知)
- 本地保存文件
- 对文件执行一些命令(未知)
我已经完成了第 1 步和第 2 步,但我在第 3 步上遇到困难。我使用以下代码:
注意:文件类型和命令仅用于测试
//Redirects output
procStart.RedirectStandardOutput = false;
procStart.UseShellExecute = true;
procStart.FileName = "C:\\Users\\Me\\Desktop\\Test\\System_Instructions.txt";
procStart.Arguments = "mkdir TestDir";
//No black window
procStart.CreateNoWindow = true;
Process.Start(procStart);
.txt
文件会打开,但是命令不会运行(test
文件夹下不会有testDir
)
建议?
最佳答案
看这里:
https://stackoverflow.com/search?q=+optimized+or+a+native+frame+is+on+top+of+the+call+stack
你不应该那样调用 Response.End
,因为这会终止它。
关于c# - 执行命令 C# 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7012139/