How to access Network drive through windows sercices in c#

Nov 11 2014 4:40 AM

I'm stuck while creating an application whose abstract work is to copy some file from host machine to network machines shared folder,

I'm doing something like this in c#

string lscmd = "robocopy "+ lsCurentWorkingDirectory+ " \\\\CPU219\\Test$ " + lsFileName;
ProcessStartInfo ProcessInfo;
ProcessInfo = new ProcessStartInfo("cmd.exe", "/c " + lcmd);
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = False;
process = Precess.Start(ProcessInfo);
process = Precess.Start(ProcessInfo);
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = False;
process = Precess.Start(ProcessInfo);
process.waitforExit();

When I'm runing this code through windows services its get stuck at process.WaitforExit(), and when I'm running this by normal console application, it works well.

plz help me


Answers (5)