Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Shellexecute xcopy to backup files from remote computer

308 views
Skip to first unread message

Harald Sandner

unread,
Aug 21, 2004, 8:35:49 AM8/21/04
to
Hi,
to backup files over the network I have used Xcopy with shellexecute.
It works so far. But I have a problem if the remote PC has a different
account. I have tried to use "net use" ( see script below). Doesnt
work because it starts it at the same time then the xcopy command.
Is there a way to either pass User and password to the shellexecute -
xcopy command or start xcopy only if net use has finished (without
using a batch file). I did not find out how to know when net use has
successfully connected the drive.

procedure Tfrm_backup.BitBtn31Click(Sender: TObject);
var
kak, kak1,mysource,mypath : string;
begin
kak:=' use x: \\10.246.52.18\c$ password /USER:10.246.52.18
\username /PERSISTENT:no';
kak1:=' use x: /DELETE';

mysource:='\\10.246.52.18\c$\daten\*.* '; //leerzeichen nicht
vergessen
mypath:=mysource+ini_deftargetpath+'\aktuell\DL0A99\Daten\'+opt;

ShellExecute(Handle, 'Open', 'net', Pchar(kak),nil, SW_Hide);
ShellExecute(Handle, 'Open', 'xcopy', Pchar(mypath),nil,
SW_Normal);
ShellExecute(Handle, 'Open', 'net', Pchar(kak1),nil, SW_Hide);

end;

I would apprechiate if anybody could help me!

Reg
Harald

0 new messages