How to download and run a file

Use this board to post your code snippets - tips and tricks
2 posts Page 1 of 1
Contributors
User avatar
II Killick8 II
Just Registered
Just Registered
Posts: 3
Joined: Sun May 22, 2011 1:43 pm

Hello everyone! In this tutorial I am going to show you how to download and run a process (file)
------------------------------------------------------------------------------------------
Create a new project and name it. Then on Form1 add ONE BUTTON
------------------------------------------------------------------------------------------
Now double click on the button and enter this code:
Code: Select all
My.Computer.Network.DownloadFile("url", "where to download")
        Process.Start("the file")
------------------------------------------------------------------------------------------
Where it says url in the code replace that with the URL of the file you want to download.
Replace where it says where to download in the code with a download location(for example: C:\MyFile.exe)
Then finally replace where it says the file in the code with the file where it downloaded to(for example: C:\MyFile.exe)
------------------------------------------------------------------------------------------
Thats it! Hope you found this tutorial helpful :D
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

Re: How to download and run a file
clanc789
You might want to notice that since you download and directly execute a file from the internet some antivirus might give an alert (though it can be a false positive). Dont know how to fix that but is something you should mention afterall.

Hope I helped, have a nice day :D
Practice makes perfect!

VIP since: 6-10-2011
2 posts Page 1 of 1
Return to “Quick Snips”