Finding the path to the application 
Author Message
 Finding the path to the application

I would like to find the my to my executable during run-time. Is there
any way to do this in Visual Basic?
Basically, I want to find which directory the running executable is in
so that I can load some of the files that the application needs from the
same directory.



Mon, 20 Jan 2003 03:00:00 GMT  
 Finding the path to the application

There is a built-in object called App that has that info, plus a lot more
about the current application. What you are looking for is App.Path.  Check
the Object Browser for other properties, etc. for the App object.


Quote:
> I would like to find the my to my executable during run-time. Is there
> any way to do this in Visual Basic?
> Basically, I want to find which directory the running executable is in
> so that I can load some of the files that the application needs from the
> same directory.



Mon, 20 Jan 2003 03:00:00 GMT  
 Finding the path to the application

Dear Mohsen,

We can use App.Path to get the path to the executable during run-time. For
more information about App object, you can read the description about this
object in VB Help.

Best Regards,
Elan Zhou
Microsoft Developer Support



Tue, 21 Jan 2003 03:00:00 GMT  
 Finding the path to the application
Hi Mohsen,

App.path will get you the path of your executable,  but to open the files
you will need to add the backslash character "\" to the path. For example:

path = App.path & "\" & "MyFile.txt"    or you could use    "\MyFile.txt"

Took me a while to figure that out <g>.

Bob Henry


Quote:

> I would like to find the my to my executable during run-time. Is there
> any way to do this in Visual Basic?
> Basically, I want to find which directory the running executable is in
> so that I can load some of the files that the application needs from the
> same directory.



Thu, 23 Jan 2003 03:00:00 GMT  
 Finding the path to the application
Hi Mohsen & Bob,

you should check to see if the backslash is already there, just in case the
app is in the root folder (eg C:\)  ie:

strAppPath = App.Path
If right$(strAppPath,1) <> "\" Then strAppPath = strAppPath & "\"


Quote:
> Hi Mohsen,

> App.path will get you the path of your executable,  but to open the files
> you will need to add the backslash character "\" to the path. For example:

> path = App.path & "\" & "MyFile.txt"    or you could use    "\MyFile.txt"

> Took me a while to figure that out <g>.

> Bob Henry



> > I would like to find the my to my executable during run-time. Is there
> > any way to do this in Visual Basic?
> > Basically, I want to find which directory the running executable is in
> > so that I can load some of the files that the application needs from the
> > same directory.



Fri, 24 Jan 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Finding Application path of VB .Net project

2. Finding the application path

3. Finding application path

4. Find path to application

5. How to Find Installed Application Path

6. Finding default file type application path

7. Setting / finding path to an Application

8. Finding an application's executable name and path

9. Long Path Names give Runtime error 76 - Path not found

10. Setting the path to the path of the current application

11. using application path (app.path)

12. Application Setup Wizard Says D:\<path>\D:\<path>\target.exe

 

 
Powered by phpBB® Forum Software