中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-25 23:47
47,812 topics / 349,910 posts / today 0 new / 48,264 members
DOS批处理 & 脚本技术(批处理室) » [Discussion] How to determine if it is a FAT32 or NTFS file system in batch processing?
Printable Version  3,406 / 19
Floor1 qinbuer Posted 2007-05-26 14:07
高级用户 Posts 228 Credits 512
OK, first of all, thank you all for your guidance. I don't know if any senior has made a summary of this aspect. If there is, this post will be regarded as a supplement, which can also guide rookies like me. The summary is as follows:

(The following commands run on NT systems)

1. fsutil (must be logged in as a member of the administrator or administrator group to use): (See floor 3)

For example: for /f "skip=1" %%i in ('wmic logicaldisk where "drivetype=3" get caption') do (
for /f "tokens=1,2 delims=:" %%a in ('fsutil fsinfo volumeinfo %%i\ ^| find "File System Name"') do echo %%i %%b
)

2. wmic (needs to be registered the first time used): (See floor 9)

For example: for /f "skip=1 tokens=1,2" %%i in ('"wmic logicaldisk get Caption,FileSystem"') do echo %%i %%j

3. chkntfs: (See floors 12, 20)

For example: for /f "skip=1" %%i in ('wmic logicaldisk where "drivetype=3" get caption') do (
for /f "tokens=1,2 delims= " %%a in ('chkntfs %%i ^|find "Type of File System"') do echo %%i %%b
)

4. Tools like md or cacls: (See floor 14)

Can judge FAT or NTFS file systems, but it seems unable to confirm whether it is FAT32 or FAT16 and others.

(The following commands run on DOS systems)

1. 00000055 33 32
First get the DBR, then see if the two bytes at offset 55 are 0x33 0x32

(http://www.cn-dos.net/forum/viewthread.php?tid=21845&fpage=1&highlight=%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F —— Brother GOTOmsdos said so, this rookie has not tested)

(The following commands require third-party tools)

1. omnifs (a tool attached in the Ghost enterprise version, the current version is v11.0.01502) (See floors 11, 16)

In addition, the GDISK mentioned by moderator gmy is known to be a hard disk partitioning tool. Can it judge the file system type? Brothers who have used it please explain. I dare not write it down before confirming it, for fear of misleading others. Please forgive me.

If there are other methods, please continue to leave a post.

[ Last edited by qinbuer on 2007-7-12 at 01:07 AM ]
Floor2 qinbuer Posted 2007-05-26 14:26
高级用户 Posts 228 Credits 512
Floor3 lxmxn Posted 2007-05-26 14:42
版主 Posts 4,938 Credits 11,386
If it is a system above XP, try this:
Floor4 qinbuer Posted 2007-05-26 14:47
高级用户 Posts 228 Credits 512
Floor5 ansipeter Posted 2007-05-26 14:48
中级用户 Posts 130 Credits 269
Sorry, I interrupted your discussion about the fsutil command.

[ Last edited by ansipeter on 2007-5-26 at 03:43 PM ]
Floor6 qinbuer Posted 2007-05-26 14:58
高级用户 Posts 228 Credits 512
This command can determine whether it is a removable drive or a fixed drive. Does that mean it can be used to detect whether a mobile medium such as a USB flash drive is inserted?
Floor7 qinbuer Posted 2007-05-26 15:02
高级用户 Posts 228 Credits 512
Thanks everyone. The command mentioned in my above question refers to fsutil fsinfo
Floor8 lxmxn Posted 2007-05-26 16:03
版主 Posts 4,938 Credits 11,386
This fsutil fsinfo command needs to specify the drive, which is not very convenient. Using wmic is better.
Floor9 terse Posted 2007-05-26 16:25
银牌会员 Posts 946 Credits 2,404
Learned from the moderator:
@echo off
for /f "skip=1 tokens=1,2" %%i in ('"wmic logicaldisk get Caption,FileSystem"') do echo %%i %%j
pause
Floor10 qinbuer Posted 2007-05-29 14:09
高级用户 Posts 228 Credits 512
Floor11 XiaoGuDong Posted 2007-05-30 21:33
初级用户 Posts 88 Credits 172
The simplest method:
@echo off
omnifs info >disk.txt
Open the text file disk.txt and it's clear at a glance!
Floor12 namejm Posted 2007-05-30 21:40
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Floor13 lxmxn Posted 2007-05-30 22:31
版主 Posts 4,938 Credits 11,386
Originally posted by XiaoGuDong at 2007-5-30 21:33:
The simplest method:
@echo off
omnifs info >disk.txt
Open the text file disk.txt to see at a glance!

Is this a method tool? Can you upload one?
Floor14 pighead123 Posted 2007-05-30 22:33
初级用户 Posts 23 Credits 42
Use md...\ to determine that FAT32 can be created, but NTFS cannot
Floor15 gmy Posted 2007-05-31 09:17
版主 Posts 392 Credits 1,113
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023