Extending this topic slightly, but not enough to deserve a new thread... The method's shown by swzoh and Alex are fine for checking whether the exe is on the old kind of path inherited from DOS.
However in Windows, an exefile may also be run by specifying the exename only (without giving the path to the exe) if it is on this list in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths Maybe Alan Campbell needs a method which tests for that as well as testing for whether the exe is on the old DOS envvar Path? Else you might end up not running a runnable exe. __________________________________________ BTW Do you remember how, long time ago, every program would offer to add its own folder to the Path? That's inefficient and fortunately going out of fashion. These days only UltraEdit recommends that. Alternative 1: It is more efficient to add an exe to the "App Paths" section of the registry than to add its folder to the Path envvar. Either use Regedit and follow the example of the other entries there, or use the reg file shown below. For example, when installing UltraEdit, it suggests adding UE to the path. Of course that actually means adding UE's program folder to the Path envvar. That's really silly for a directory containing only one relevant exe; do you really want UE's folder to be searched every time you run any exe without specifying its filepath? If you allow several apps to use that method, you will soon add quite an overhead to the filing system. Alternative 2: If you must add a program such as 2ppvar.exe to the Path, (preferring the Path envvar to the App Paths registry key for some reason) it seems better to copy it into a folder which is already on the path, such as \Windows\. Or make only one folder, such as c:\utils or c:\dos, to be your *only* additional Path folder; then copy every exefile such as 2ppvar and xxcopy.exe into that. _____________________________________________ To add an exe to the preferable App Paths key: You can copy and paste the following lines into a new file called AppPath.reg; edit it, to suit the actual exename and its path; then double-click to Merge: - - - - - - - - - - - - - - - - - - - REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\UEDIT32.exe] ;; in case Yahoo wraps it, the above was all one line. @="C:\\apps\\UltraEdit\\uedit32.exe" "Path"="C:\\apps\\UltraEdit" - - - - - - - - - - - - - - - - - - - Notice that, unlike the Path envvar, the App Paths key also allows you to specify a starting folder for the app (where the app will look for documents, data files, etc by default). _____________________________________________ Of course that leaves us with the problem of how to check whether app.exe is "on the path" in the broadest meaning of that, defined as: "can it be run without specifying its filepath (not only via the Path var but also via the App Paths key)". Alan Martin ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/JV_rlB/TM ---------------------------------------------------------------------~-> **** EDIT YOUR POSTINGS !!!! **** Please remove as much as possible from original messages before replying to them. ________________________________________________ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/power-pro/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
