While I've got code I've been using for a long time ("%@ExecStr" a batch file), it would be really nice if in addition to "Exist", "IsFile", and "IsDir", there was an "IsPath" (for instance), which would be true if the given path is valid. In the case of the rightmost component of the path, just verify that the name is acceptable ("St*r", for instance, would fail the test) and for the rest of the path (everything preceding the rightmost component and separated from the rightmost component by a back slash) that the drive (if specified) and all of the leftmost components of the path are valid, exist, and are directories.
Just for reference, the existing batch file echos:
3 For a valid device (CON:, LPT1:, COM2, NUL:, etc.)
2 For an existing directory
1 For an existing file
0 For a valid name that does not exist
-1 For a high-order component that is not a valid path (not all components exist and are directories.
-2 For an invalid (syntax) path/name
-999 For something that exists but is not a file, a directory, or a device
(Should really never happen)
This, of course, wraps all of the tests into one value.
Just for reference, the existing batch file echos:
3 For a valid device (CON:, LPT1:, COM2, NUL:, etc.)
2 For an existing directory
1 For an existing file
0 For a valid name that does not exist
-1 For a high-order component that is not a valid path (not all components exist and are directories.
-2 For an invalid (syntax) path/name
-999 For something that exists but is not a file, a directory, or a device
(Should really never happen)
This, of course, wraps all of the tests into one value.