Reputation: 785
I want to perform file copying from local HDD to a server - to access the server it require to insert username and password, at manual when I write the server name: \neoserver a window popup and after inserting username and password all the server's file appeared. to perform the copying I use the command: File.copy(source path, destination path) how can I write the server's path in a way it won't require user@pass???
Upvotes: 1
Views: 681
Reputation: 499002
You can use Process.Start
to call the copy
command line executable with the right credentials and parameters.
For best control, use ProcessStartInfo
to supply all the information needed:
ProcessStartInfo startInfo = new ProcessStartInfo("copy");
startInfo.Arguments = "source dest";
startInfo.UserName = myUser;
startInfo.Password = myPassword;
Process.Start(startInfo);
Upvotes: 2