Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 18-07-2008, 04:09 PM   #1
 
mcloum's Avatar
 
Join Date: May 2007
Location: Hull, UK
Posts: 94
Thanks: 1
Thanked 5 Times in 5 Posts
Rep Power: 4 mcloum is on a distinguished road
Send a message via MSN to mcloum
Default vb.net Run exe from Applications path

Hi all,

Ok im making a little GUI to allow easy installation of smart notebook via a VB form. This is going to be used as an autorun on a CD so i need to get the path that the exe is running from (the CD drive letter) then execute the MSI for smart notebook with a few switches.

This is what i have so far.

Code:
Imports System.Diagnostics.Process

Public Class Form1

    Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        MsgBox("Not here yet")
    End Sub

    Private Sub btnSmart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSmart.Click
        Process.Start("SmartTools.msi /Passive NOTEBOOK_ONLY=1")
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim AppPath As String
        AppPath = Application.StartupPath
        lblAppPath.Text = AppPath
    End Sub
End Class
as you can see i have got the path that the exe is running from but i dont know how to integrate it with the process.start command.

Any ideas?

Cheers

Mike
  Reply With Quote
Old 18-07-2008, 06:31 PM   #2
 
PeterH's Avatar
 
Join Date: Oct 2005
Posts: 12
Thanks: 3
Thanked 3 Times in 3 Posts
Rep Power: 7 PeterH is on a distinguished road
Default

Give the code below a try. You didn't mention what vesion of VB you're using - the code below works on 2005, .Net Framework v2.

It's probably better to call msiexec.exe directly and then pass the msi file as a parameter. You can specify both a filename and parameters in the process.start method

You can get the full path to the MSI by using & to concatenate the application.startuppath and the MSI filename. You'll need to wrap the whole string in " " ( chr(34) ) in case there's any spaces in the path.

However, you might still have a couple of problems. Firstly, you will need to ensure that the .Net framework is installed on every machine you're going to run the CD on.

Also, I've not tested running it direct from CD, but you may have problems with the default .Net Code Access Security Policy preventing the EXE file from running from the CD Drive. The default policy allows .Net EXEs to run from C: drive but not from network drives for example. I'm not sure about CDROM drives. It can be changed but it's something you'd have to do on each machine before running the CD.

You'd probably be better off with a batch file or a VBScript.


Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim myPath As String
        Dim myMSI As String

        myPath = Application.StartupPath & "\"
        myMSI = Chr(34) & myPath & "Smarttools.msi" & Chr(34) & " /Passive NOTEBOOK_ONLY=1"

        Process.Start("c:\windows\system32\msiexec.exe", " /i " & myMSI)

    End Sub
End Class
  Reply With Quote
Old 20-07-2008, 04:46 PM   #3
 
mcloum's Avatar
 
Join Date: May 2007
Location: Hull, UK
Posts: 94
Thanks: 1
Thanked 5 Times in 5 Posts
Rep Power: 4 mcloum is on a distinguished road
Send a message via MSN to mcloum
Default

Thanks i will test this later tonight.

You would think it would allow exe to be run from CD as most games/apps have a little GUI then you click an install button and the msi is triggered.

I will report back with the results later.

Mike
  Reply With Quote
Old 20-07-2008, 04:56 PM   #4
 
powdarrmonkey's Avatar
 
Join Date: Feb 2008
Location: Alcester, Warwickshire
Posts: 1,078
uk
Thanks: 58
Thanked 104 Times in 87 Posts
Rep Power: 22 powdarrmonkey is a glorious beacon of lightpowdarrmonkey is a glorious beacon of lightpowdarrmonkey is a glorious beacon of lightpowdarrmonkey is a glorious beacon of lightpowdarrmonkey is a glorious beacon of lightpowdarrmonkey is a glorious beacon of light
Default

Why not make use of autorun.inf? It's a lot simpler.
  Reply With Quote
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Force Run .exe from a Intranet Page? Silverman Web Development 2 02-07-2008 11:21 AM
Stopping .exe files from being run from a USB stick Kyle Windows 13 02-04-2008 10:47 AM
SIMS .net backup path Jawloms MIS Systems 2 26-10-2007 03:17 PM
Deploy/run SIMS from UNC path? ajbritton MIS Systems 8 04-04-2007 02:25 PM
Run local exe from url link alan-d Web Development 6 18-01-2007 10:34 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 01:39 AM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net