Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/articles/programming/)
-   -   Batch Script to list Drives and Types (http://www.go4expert.com/articles/batch-script-list-drives-types-t23215/)

Cleptography 6Sep2010 06:47

Batch Script to list Drives and Types
 
This .bat file uses fsutil to get a list of the drives and types on a windows machine.

Batch Script to list Drives and Types
------------------------------------------
Code:

@echo off
 setlocal

::
REM Get and list drive types using fsutil
::
        set "list="
       
        for /f "tokens=*" %%a in ('^
        fsutil fsinfo drives^|^
        find /V ""'

) do (

        set "dv=%%a"
        call set "list=%%list%% %%dv:~-3%%"
)
        for %%a in (%list%) do (
        fsutil fsinfo drivetype %%a
)


shabbir 4Oct2010 10:22

Re: Batch Script to list Drives and Types
 
If you liked this article do nominate this article for Article of the month - Sep 2010 Before 15th of October 2010.

Cleptography 13Mar2011 07:49

Re: Batch Script to list Drives and Types
 
The original above script does not apply to Windows 7 instead use this to pipe the info using DiskPart
Code:

@echo off

echo.list vol | DiskPart | find /i "partition"
echo.list vol | DiskPart | find /i "DVD-ROM"
echo.list vol | DiskPart | find /i "Removable"



All times are GMT +5.5. The time now is 10:03.