Working with executables.

Is it possible in .net visual C# to copy and program.exe file from a remote source to the local pc and execute the program with command line switches?
Who is Participating?
Rob SiklosConnect With a Mentor Commented:
To copy the file:

   File.Copy(@"\\machinename\c$\myapp.exe", @"c:\myapp.exe");

To execute the file:

Process myProcess = new Process();
myProcess.StartInfo.FileName = @"c:\myapp.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.Arguments = "/c /b /f=test";
myProcess.StartInfo.UseShellExecute = false;

Open in new window

Rob SiklosCommented:
Sure, what's the remote source?  Network share? FTP? HTTP?
edrosieAuthor Commented:
Network Share

edrosieAuthor Commented:
Thank you very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.