PATHEXT

Print Topic  Return to Overview  Previous Topic  Next Topic 

PATHEXT is expected to contain a list of extensions (including a leading period .), separated by semicolons. For example, to replicate the default extension list used by TCC:

 

set pathext=.pif;.com;.exe;.btm;.bat;.cmd;.rex;.rexx

 

If you use a command in a batch file or at the command prompt and all of the following are true:

 

the PathExt configuration option is set
the command is not an alias
the command is not an internal command
the command is not a filename with an explicit extension (thus neither an executable extension nor a Windows file association is available)

 

then TCC will search each directory listed in PATH in turn for a file with its name matching the command and its extension matching one of the extensions in PATHEXT. The 1st directory in PATH is searched first, then the 2nd, looking in each for each of the extensions in PATHEXT in the order listed.

 

Enabling PATHEXT affects only the standard path search. It does not affect searches for files with explicit extensions, which must have either a standard extension (see list above), or one which is either an executable extension or a Windows association.

 

Caution:  If you set the PathExt configuration option, and fail to set the PATHEXT variable, path searches without an explicit extension will fail as there will be no extensions for which to search! (Windows XP does define a default value for the PATHEXT variable.)

 

Topic "pathext.htm" last edited 1/27/2008. ©2008  JP Software, Inc.
Keywords: PATHEXT