1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Batch Script to list Drives and Types

Discussion in 'Programming' started by Cleptography, Sep 6, 2010.

  1. Cleptography

    Cleptography New Member

    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
    )
     
  2. shabbir

    shabbir Administrator Staff Member

  3. Cleptography

    Cleptography New Member

    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"
     
    Last edited: Mar 13, 2011

Share This Page