有几种方法可以做到这一点.
一种原始的方法是chkdsk在您感兴趣的卷上运行并捕获输出.部分输出指示磁盘是否为NTFS.不幸的是,这比预期的要多,可能还需要一些时间.
同样,您可以解析其输出fsutil fsinfo volumeinfo c:\类似于:
Volume Name : Primary
Volume Serial Number : 0x4f70e7b
Max Component Length : 255
File System Name : NTFS
Supports Case-sensitive filenames
Preserves Case of filenames
Supports Unicode in filenames
Preserves & Enforces ACL's
Supports file-based Compression
Supports Disk Quotas
Supports Sparse files
Supports Reparse Points
Supports Object Identifiers
Supports Encrypted File System
Supports Named Streams
Run Code Online (Sandbox Code Playgroud)
通过提取文件系统名称,您可以找到所需内容.
一种稍微不那么原始的方法是使用带有WMI的VBScript来遍历设备阵列,检查您感兴趣的每个卷.
该Win32_LogicalDisk级(在Windows 2000年起有售)有FileSystem这表明这一点,你可以使用下面的代码作为基础属性:
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colVols = objWMIService.ExecQuery ("select * from Win32_LogicalDisk")
For Each objVol in colVols
MsgBox objVol.Name & " : " & objVol.FileSystem
Next
Run Code Online (Sandbox Code Playgroud)
看起来试图file.name:strmname在FAT卷上使用备用文件流()失败,那么如何:
@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
Run Code Online (Sandbox Code Playgroud)