tags:

views:

104

answers:

3

When I am running

myProcess = Process.Start("something.exe")

and want to start it using button it doen not find the file - i need to execute it from the same folder where application is how can i do that? Thank you.

System could not find this file - but it is there . in the same folder as application.

Using Visual Basic 2008 Express

A: 

When running from VS the folder with your application is the bin/Debug or bin/Release. The program should be there.

Another option is to add the path to the program extracted from Assembly.GetExecutingAssembly().GetName().CodeBase

kubal5003
I move the application to another folder and i need to execute the program from the same folder as program is - everytime i move it - and when it cannot find it - ask for folder where is.
Hallgaws
So this is the way you can extract the path where the executing assembly (exe) is.
kubal5003
A: 

You should try something like

Process.Start(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "notepad.exe"))
astander
It doesnt work it says:"This is the next statement that will be executed. To change which statement is executed next drag the arrow. This may have unintended consequences." - File not found.
Hallgaws
A: 

When I add there this:

System.Diagnostics.Process.Start(System.IO.Path.Combine(My.Application.Info.DirectoryPath, "something.exe"))

It is working thanks for help - FIXED :-)

Hallgaws