views:

9

answers:

0

I'm trying to automatize the disc space info for all local partitions.

The 'fsutil info drives' gives the following:

C:\cmd>fsutil fsinfo drives

Drives: C:\ D:\ E:\ F:\ I:\ Z:\

Now I have the following:

for /F "tokens=2,* delims=\  " %i in ('fsutil fsinfo drives') do ( fsutil volume diskfree %i );
C:\cmd>(fsutil volume diskfree C:  )
Total # of free bytes        : 13169991680
Total # of bytes             : 99641004032
Total # of avail free bytes  : 13169991680

Note: the space after "delims=\" is a tab.

I want it to give this info for every drive on my machine.

So practically, the for I've described doesn't return an array or set of drive labels.

Thanks.

PS: I know this can be done very easy in Bash, and also that there are GNU utils for that. I need it with native WIN commands to be able to execute it on any windows machine without installing/copying anything.

Update: I've opened the output of the 'fsutil info drives' in gvim with ":set list" option to see what the delimiters are:

Drives: C:\^@D:\^@E:\^@F:\^@I:\^@Z:\^@

I don't know what the "^@" chars are. Anyone knows? Google doesn't know.