(view source code of filesys.bat as plain text)
@ECHO OFF
:: Windows NT 4 / 2000 only
IF NOT "%OS%"=="Windows_NT" 1 GOTO Syntax
:: Keep variables local
SETLOCAL ENABLEEXTENSIONS
:: Parameter check
ECHO.%1 | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
:: Extract drive letter
SET Drive=%1
IF DEFINED Drive SET Drive=%Drive:~0,1%
CALL :Drive %Drive%:
:: FAT
SET FS=FAT
:: Test "last accessed"time, if 00:00 for every file we may presume FAT
FOR /F "TOKENS=2,3* DELIMS= " %%A IN ('DIR/A/TA/P/-P/W/-W %Drive% 2^>NUL ^| FIND ":" ^| FIND "-"') DO IF NOT "%%A"=="00:00" SET FS=
DIR %Drive% >NUL 2>&1
IF ERRORLEVEL 1 GOTO NotReady
IF NOT "%FS%"=="" GOTO Display
:: NTFS
SET FS=NTFS
:: NTFS check needs a temporary file name
SET TEMPFILE=
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO FOR %%B IN (0 1 2 3 4 5 6 7 8 9) DO CALL :TempFile %%A%%B %1
IF "%TEMPFILE%"=="" GOTO NoTemp
:: Test alternate data streams, a feature unique for NTFS
(ECHO %~nx0 > %TEMPFILE%:NTFSTEST) >NUL 2>&1
IF NOT EXIST %TEMPFILE% SET FS=unknown
IF EXIST %TEMPFILE% DEL %TEMPFILE%
:Display
ECHO.
ECHO File system of drive %Drive% is %FS%
GOTO End
:Drive
SET Drive=%~d1
goto:EOF
:TempFile
IF NOT "%TEMPFILE%"=="" GOTO:EOF
IF NOT EXIST %~d2\%~n0.%1$ SET TEMPFILE=%~d2\%~n0.%1$
GOTO:EOF
:NoTemp
ECHO.
ECHO Unable to create a temporary file for the NTFS check.
ECHO Temporary file names %Drive%\%~n0.00$ through %Drive%\%~n0.99$
ECHO all seem to be in use already.
GOTO End
:NotReady
ECHO.
ECHO Drive %Drive% is not ready
GOTO End
:Syntax
ECHO.
ECHO FileSys, Version 4.00 for Windows NT 4 / 2000
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO Usage: FILESYS [ drive ]
ECHO.
ECHO If no drive is specified, current drive is assumed
GOTO End
:End
ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0099 seconds