'Download a file and then execute it
I'm creating an application that downloads some applications (like FireFox, WinRar, RealPlayer) and then install them silently using Shell command. This is the code:
My.Computer.Network.DownloadFile("URL", "path\file.exe")
Shell("path\file.exe /s")
The problem is that the shell command starts before Download Is completed, so I get a "file not found" error. So my questions are:
- How can I execute Shell command after the download is completed?
- Can I use process.start with
Sparameter instead of Shell command?
Solution 1:[1]
This should do the trick to download the file and wait until its over:
Dim wc As WebClient = New WebClient()
wc.DownloadFile(sURL, sFile)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SysDragon |
