Search code examples
batch-filentfsfat32

How can I use batch to determine if a computer is using FAT32 or NTFS?


How can I use batch to determine if a computer is using FAT32 or NTFS and is this even possible.


Solution

  • It looks like attempting to use an alternate file stream (file.name:strmname) on a FAT volume fails, so how about:

    @echo off
    set drv=C:
    set file=temp.temp
    
    if exist %drv%\%file% del %drv%\%file%
    @echo 1 > %drv%\%file%:stream
    if not exist %drv%\%file% goto FAT
    
    :NTFS
    echo is NTFS
    del %drv%\%file%
    goto eof
    
    :FAT
    echo is FAT
    goto eof
    
    :eof