Resolved Run exe immediately of a CD?

Kangaroo

New member
Joined
Aug 24, 2009
Messages
2
Programming Experience
Beginner
Hi all,

I am very very new to VB. I have had absolutely no prior experience in any programming whatsoever. Yesterday I downloaded the visual basic 2008 express edition from Visual Basic 2008 Express Edition.

I have a small question which I am sure is very easy for somebody else to answer and I apologise in advance if this question is in the wrong section.

I wanted to make a small exe to autorun from a cd. I want to be able to hand the cd out to friends and family. So far I have achieved what I wanted with the little app. On the cd I have an exe file in a particular folder that when clicking a command button on a windows form - I would like to run this exe.

At the moment I have:

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Shell("explorer.exe ..\appfolder\application.exe")
End Sub


This finds and selects the application as required, however It does not run it. Another box comes asking me "Do you want to run or save this file?" If I click run, another box comes up "The Publisher could not be verified, are you sure you want to run this application?"

My quesiton is, what code to I need to enter or change to make this exe run immediately as if I were the same as browsing for it and double clicking on it?

Any help would be much appreciated. :D
 
Last edited:
Well the two things I see is: #1 you're using shell() to start a process when you should be using System.Diagnostics.Process.Start() which gives you much more flexibility. #2 You're calling Explorer.exe (windows) to run an exe file, you could just do this: System.Diagnostics.Process.Start("..\appfolder\application.exe")

I believe using a relative path "..\" is allowed, if not there's a work around for even that.

Also keep in mind that putting a .net app right on a cd might not work for some, .net apps need to have the .net framework installed for it to work and if it's not, they'll just get an error when they insert the cd (cause the autorun calls your .net exe which errors cause of no framework being installed) so as long as they have winXP or newer with the windows updates all installed, they'll have the framework and everything's fine.

Also thread moved to vb general.
 
Excellent!

You have been very helpful and it works a treat.

Should have used System.Diagnostics.Process.Start("..\appfolder\app lication.exe")

:D:D
 
Back
Top