How to download and run a file
Use this board to post your code snippets - tips and tricks
2 posts
Page 1 of 1
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:
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
------------------------------------------------------------------------------------------
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

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
Hope I helped, have a nice day

Practice makes perfect!
VIP since: 6-10-2011
VIP since: 6-10-2011
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023