In tip 3579 and link, we parsed batch parameters.
Windows 2000 supports a special format, %~ftza1, which will expand the batch parameter (1) to a dir-like output line.
If you call a batch with a file name that is in the current directory, or with a fully qualified file name, the %~ftza1 syntax will yield a dir-like output line. If the file is not found, it will return the input or implied path. Examples:
The batch file contains:
If the current folder is C:, a call testbatch filename.txt will set test to c:\filename.txt if the file does not exist. If c:\filename.txt exists, test would be set similar to:
--------- 12/07/99 08:00 50960 C:\filename.txt.
If you call testbatch D:\TEMP\filename.txt, test would be set similar to:
-rahs---- 04/12/01 09:32 19456 D:\TEMP\filename.txt
You can determine if the file was found by including:
if "%test:~0,1%" EQU "-" goto found
NOTE: See the file attributes at -rahs----.