for /f "tokens=2" %%i in ('fsutil fsinfo drives') do set j=%%i
and then using another parser based on the following to determine
what type of drive each was:
for /f "tokens=3" %%i in ('fsutil fsinfo drivetype %j%') do set k=%%i
The problem is that 'fsutil fsinfo drives" returns a string such as:
Drives: A:\ C:\ D:\ E:\ M:\ N:\
but where the "spaces" are actually nul characters. These causes the
FOR statement to be unable to read tokens past the first nul.
Any ideas?
The thing to do here is pipe the output through another command, such
as MORE, which effectively regards the NUL character as CR/LF. For
instance, this command:-
fsutil fsinfo drives|more
Gives an output like this:-
Drives: A:\
C:\
D:\
E:\
M:\
N:\
Then pass each line your 'fsutil fsinfo drivetype' command. Only trouble is,
you need to lose the string 'Drives: '. One way of doing this is to use a
space as a delimiter and then reverse the tokens and use the first. For
example:-
for /f "tokens=1,2" %%a in ('fsutil fsinfo drives^|more') do (
for /f "tokens=1" %%c in ('echo/%%b %%a') do fsutil fsinfo drivetype %%c
)
--
Ritchie
Anyone know what kind of idiot decided to have FSUTIL separate drive letters
with NULs?
It was brother of another idiot who decided FSUTIL output messages
be translated in localized versions of WinXP. Now we need different
version of the parsing script for each national version of Windows.
Bye,
v
Sr.
C:\>FOR /F "delims=\" %A IN ('%.eListCD%') DO @ECHO:%A
C:
D:
T:
C:\>FOR /F "delims=:\" %A IN ('%.eListCD%') DO @ECHO:%A
C
D
T
*******
The .ListCD page is at
(http://TheSystemGuard.com/MtCmds/ListValue/ListCD.htm)
*******
Notes:
1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
2. .M/\C's are NOT case sensitive. Mixed case is used
for visual clarity only.
3. ntlib.cmd provides over 100 resources to assist with
writing and documenting cross-platform scripts,
including 57 .M/\C's. You can obtain it (for FREE)
at http://ntlib.com.
*******
TheGuardBook contains a "Mounted Help" page for each internal cmd.exe
command. This is a single color-coded page, highlighting the differences
among the NT/2K/XP/K3 versions. The complete help text for each OS is also
available for comparison (http://TheSystemGuard.com/TheGuardBook/CCS-Int.)
*******
-tsg
____________________________________________________________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!
"John Clavin" <j...@austin.rr.com> wrote in message
news:Xns931CE08D4...@24.28.95.150...