C# win 表单
你好。CMD windows一直说“系统找不到指定的文件”如果我在CMD窗口中输入命令“copy /b myfile.txt test.txt”它可以工作:S
顺便说一句:有没有办法实际看到在 CMD 窗口中执行的命令?
public void OutputBtn_Process_Click(object sender, EventArgs e)
{
foreach (FileInfo fi in listBox1.Items)
{
Process process1 = new Process();
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.Arguments = "copy /b \""+fi.Name+"\"test.txt";
//process1.StartInfo.LoadUserProfile = true;
process1.StartInfo.FileName = "cmd.exe\"/k";
process1.StartInfo.WorkingDirectory = Path.GetDirectoryName(fi.FullName);
process1.Start();
process1.Dispose();
process1.Close();
}
}