是否有人可以幫助我走出這裏的語法命令語法的ProcessStartInfo
string sourcePath = @textBox2.Text.ToString();
string targetPath = @textBox1.Text.ToString();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"XCOPY C:\folder D:\Backup\folder /i");
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
System.Diagnostics.Process copyFolders = System.Diagnostics.Process.Start(psi);
copyFolders.WaitForExit();
我想下面更改此行來替換C:\文件夾(SOURCEPATH)和D:\Backup\folder
與TARGETPATH
(@"XCOPY C:\folder D:\Backup\folder /i");
我不斷收到沒有找到來源,當我的MessageBox這樣它看起來不錯
MessageBox.Show(@"XCOPY " + (sourcePath) + (targetPath) + " /i");
感謝Mike C使用此代碼 string args =(sourcePath)+「」+(targetPath); System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(「XCOPY」,args +「/ i」); – Zen