View Full Version : Simple VB6 Path Question

08-23-2007, 05:06 PM
Does anyone know how I can detect the location of the binary in a VB6 application?

Unfortunately, I inherited some bad code (if you look at my past posts, it seems like a common theme at my job) that does some extremely glitchy and bad absolute pathing. The issue is that this is supposed to be a distributable application, and if you install it on a location other than C:, you are screwed!

So i need to have a way of detecting the location of the executable on start-up every time and then relative path from there.

Unfortunately, not completely familiar with the quirks of VB and a couple of quick googles didn't find me anything. My search terms might be lacking (4 hours of sleep, not feeling it).

Any help much appreciated! Thanks in advance!

08-23-2007, 05:22 PM
Well, I didn't know the answer myself either, so I did a quick search on VB's FSO and I found this page: http://www.aivosto.com/visdev/fso.html

Below is a quick code snippet:

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(App.Path)
That should get you what you need hopefully.


08-23-2007, 07:03 PM
Thanks a bunch! That definitely did the trick!

08-23-2007, 09:03 PM
You should be able to just do App.Path to get the current executing location of your program.