Code snippet:
for /F %%G in (' wmic path win32_volume where "Caption='C:\\'" get FileSystem /value^|findstr "=" ') do for /F %%g in ("%%~G") do set "_%%~g" set _FileSystem
Output:
==>for /F %G in ('wmic path win32_volume where "Caption='C:\\'" get FileSystem /value ^|findstr "="') do @for /F %g in ("%~G") do @set "_%~g" ==>set _FileSystem _FileSystem=NTFS ==>
Resources (required reading):
- (command reference) An A-Z Index of the Windows CMD command line
- (additional particularities) Windows CMD Shell Command Line Syntax
- (
%~G
etc. special page) Command Line arguments (Parameters)
Edit to get file system for all live drives:
@ECHO OFF >NUL rem SETLOCAL enableextensions for /F %%X in (' wmic path Win32_LogicalDisk get caption /value^|findstr "=" ') do for /F "tokens=2 delims==:" %%x in ("%%~X") do ( for /F %%G in (' wmic path win32_volume where "Caption='%%~x:\\'" get FileSystem /value^|findstr "=" ') do for /F %%g in ("%%~G") do set "_%%~x-%%~g" ) set _
Output
==>set _ Environment variable _ not defined ==>D:\bat\SU\929159.bat _C-FileSystem=NTFS _D-FileSystem=NTFS _E-FileSystem=CDFS ==>set _ _C-FileSystem=NTFS _D-FileSystem=NTFS _E-FileSystem=CDFS ==>