By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

visual basic - button to run command or vb script (from same directory)

P: 1
Hey there,

I have a .exe form I created with buttons to launch apps/scripts. The buttons are coded like so:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click 
  2.         Process.Start("C:\folder\file.exe") 
  3.     End Sub
  4.  
  5.  
This works great but now I want to run this .exe from a usb drive that has the folders\files.exe.

How would I change this code so the buttons will just launch the files from the same folder the .exe was launched from?
Aug 6 '14 #1
Share this Question
Share on Google+
1 Reply


P: 2
What i understand is you have more than .exe
Main .exe that will launch the other .exe
if i understand right
you can do it like this

Expand|Select|Wrap|Line Numbers
  1.  Dim MyPath As String
  2.         MyPath = IO.Directory.GetCurrentDirectory()
  3. Process.Start(MyPath & "\file.exe")
  4.  
Aug 7 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.