changobutt Posted December 18, 2003 Posted December 18, 2003 I'm trying to run an .msi file using the Shell function, but I guess it doesn't like it. Shell("C:\mySetup.msi", AppWinStyle.NormalFocus, True) It gives me the following error: ------------------------------------ An unhandled exception of type 'System.IO.FileNotFoundException' occurred in microsoft.visualbasic.dll Additional information: File not found. ------------------------------------ Is there a way I can execute an .msi file with code? Thanks! Quote
*Experts* Bucky Posted December 18, 2003 *Experts* Posted December 18, 2003 Eek, don't use Shell... that's one of the old VB6 functions. Use System.Diagnostics.Process.Start("C:\mySetup.msi") But, if the error says the file is not found, then chances are you're passing an incorrect filename. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
changobutt Posted December 18, 2003 Author Posted December 18, 2003 Awesome! Thanks a bunch! Now, is there a way to wait for the process to finish (for the .msi installation to be closed) before giving the control back and executing the next line of code? Thanks again! Quote
*Experts* Bucky Posted December 19, 2003 *Experts* Posted December 19, 2003 Yeah. The static Process.Start() method returns a Process object, which has a WaitForExit() method (how handy!). Dim p As System.Diagnostics.Process p = System.Diagnostics.Process.Start("C:\mySetup.msi") p.WaitForExit() Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.