Mega Code Archive

 
Categories / Delphi / Files
 

Tek satır komutla klasör kopyalama, alt klasörlerle birlikte

{ Öncelikle doskomutu denen prosedürü (buralarda bir yerdeydi kodbankta) unit içine ekleyin. Aşağıya da yazdım. Sonra da herhangi bir nesneye (buton gibi) ya da formda herhangi bir event içine ikinci prosedürü yazın. EditBox lar kullanılarak kullanıcıdan girdi de alınabilir komut satırı oluşturmak için. } procedure doskomutu(komut:string;mesajver:boolean); var Startupinfo:TStartupinfo; ProcessInfo:TProcessInformation; begin if terminateprocess(processinfo.hProcess,0)=NULL then begin if mesajver then showmessage('Devam eden islem iptal edilemedi'); exit; end; FillChar(StartupInfo,Sizeof(StartupInfo),#0); StartupInfo.cb := Sizeof(StartupInfo); StartupInfo.wShowWindow := SW_HIDE; StartupInfo.dwFlags:=STARTF_USESHOWWINDOW; if not CreateProcess(nil, Pchar('c:\command.com /c '+komut), nil, nil, true, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then begin if mesajver then ShowMessage('Islem gerceklestirilemedi') end else begin if mesajver then ShowMessage('Islem tamam') end; end; ////////////////////////////////////////////// procedure TForm1.Button1Click(Sender: TObject); begin doskomutu('xcopy c:\Klasor d:\Klasor1 /E',false); end;