Announcement

Collapse
No announcement yet.

How to determine the path my .EXE is in???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    PBCC 5+, PBWIN 9+
    Code:
    programpath$= EXE.PATH$
    Caution until the doc improvement suggestion I sent in yesterday appears in the help file: "EXE.Path$ is returned with the trailing backslash."

    (I sent in suggestion because yesterday I had to guess if it was supplied or not. I guessed wrong).

    Leave a comment:


  • Knuth Konrad
    replied
    Originally posted by Hans-Dieter Veit View Post
    But be aware that this will cause problems if your user runs VISTA
    This has been a problem since W2K at least, because users running under a restricted account (recommended for all non-administrative tasks) don't have rights to create files in %PROGRAM FILES%.

    It was just that everybody and his dog did run their machines with an account having administrative privileges ...

    Leave a comment:


  • Klaus Schussler
    replied
    I found this code below on poffs:

    Code:
    FUNCTION AppFullPath() AS STRING         'get the path of this exe file
        LOCAL appFilename  AS ASCIIZ * 255
        LOCAL PathPos      AS LONG
        GetModuleFileName GetModuleHandle(""), appFilename, 255
        PathPos = INSTR(-1,appFilename,"\")   'find the LAST "\" and hack out the -1 in instr func
        FUNCTION = LEFT$(appFilename,PathPos)
    END FUNCTION
    Use: exe_path$ = AppFullPath

    K.

    Leave a comment:


  • Bern Ertl
    replied
    Locating Data and Configuration Files

    Leave a comment:


  • Cliff Nichols
    replied
    Try this Instance Parent on post #18 I posted code that will show you where your program is running from

    Leave a comment:


  • Michael Mattias
    replied
    Move That INI File! and Get That Ini File Name!

    You can put your data files in the same folder as the INI file, or make a subfolder for data.

    Leave a comment:


  • Hans-Dieter Veit
    replied
    Originally posted by Jim McLachlan View Post
    I would like to create a file in that folder but ...
    But be aware that this will cause problems if your user runs VISTA

    Hans

    Leave a comment:


  • Jim McLachlan
    replied
    many thanks Paul!

    Leave a comment:


  • Paul Squires
    replied
    If you are using PB9 then check out the "EXE" statement in the Help file. If you want to use the WinAPI then do a search on these forums for GetModuleFileName.

    Leave a comment:


  • Jim McLachlan
    started a topic How to determine the path my .EXE is in???

    How to determine the path my .EXE is in???

    Often users create a shortcut to run my program and for various valid reasons they will set a "start in" path of their own making. I also do not know where my program file (the .EXE file) resides. I would like to create a file in that folder but I don't know how to determine where the user installed it. Aside from registry crap, is there an environment variable or something in PB I can use to get the path that the .EXE is in? CURDIR is not what I am after.

    Thanks!
Working...
X