[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

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?
0
edrosie
Asked:
edrosie
  • 2
  • 2
1 Solution
 
Rob SiklosCommented:
Sure, what's the remote source?  Network share? FTP? HTTP?
0
 
edrosieAuthor Commented:
Network Share

0
 
Rob SiklosCommented:
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;
myProcess.Start();

Open in new window

0
 
edrosieAuthor Commented:
Thank you very much
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now