-8

I search how to add a download & execute function in my tool. Its a C# Program and i need code for download a .exe file with url and execute them. I use Visual Studio 2017.

Thanks for helping me.

Its working with .exe ?

Download Save And Run

  • Possible duplicate of [Download Save And Run](https://stackoverflow.com/questions/13783431/download-save-and-run) – Vadim Iarovikov Dec 10 '17 at 18:21
  • 1
    this is a poorly written question you need to show us what you have tried on your own. just posting `I search how to add a downloand & execute` indicates you haven't put in much effort. this will probably be closed / downvoted because it's very low quality question to say the least – MethodMan Dec 10 '17 at 18:22

1 Answers1

-2

Here is a method that takes the direct link of the file you want to download. It will download the file and execute it.

using System.Net;
using System.IO;

void DownloadFileAndExecute(string link)
{
  WebClient wc = New WebClient();
  string filename = Path.GetFileName(link);
  wc.DownloadFile(link, filename)
  Process.Start(filename)
}
M.Boukhlouf
  • 303
  • 2
  • 10