VOL
Displays the disk volume label and serial number, if the disk has them.
Syntax
VOL [drive:]
Parameters
drive:
Specifies the drive that contains the disk for which you want
to display the volume label and serial number.
To display the volume label of the disk in the current drive,
you can use the VOL command with no parameter.
Related Commands
For information about the [/V[:label]] switch, see the <FORMAT> command.
For information about assigning a volume label, see the <LABEL> command.
Batch Example
@echo off %[-- Notice: WRAP/broken lines --]%
:xx (Uppercase)
choice /n /cABCDEFGHIJKLMNOPQRSTUVWXYZ Choose Drive Or Hit ESC:
for %%v in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if er
rorlevel xx%%v set drive=%%v
if not errorlevel 27 for %%v in (echo.------------[Uppercase]:%drive% ech
o. goto:xx) do %%v
for %%v in (set cls) do %%v drive=
:x (lowercase)
choice /n /cabcdefghijklmnopqrstuvwxyz choose drive or hit ESC:
for %%v in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if er
rorlevel x%%v set drive=%%v
if not errorlevel 27 for %%v in (echo.------------[lowercase]:%drive% ech
o. goto:x) do %%v
for %%v in (set cls) do %%v drive=
VOL--Batch Example
@echo off %[-- Notice: WRAP/broken lines --]%
choice /n/cabcdefghijklmnopqrstuvwxyz Please choose a let
ter for a valid drive:
if not errorlevel 17 goto end
for %%v in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if er
rorlevel %%v set drive=%%v
ver | find "Windows 9" > nul
if not errorlevel 1 goto win9x
vol %drive%: | find "%drive% "
for %%v in (set pause cls goto:end) do %%v drive=
-------------------------------------------------------------------------
:win9x -- example, (redirection of output)
rem > [2].bat
for %%v in (@echo:off "if not '=='%%1 goto v") do echo:%%v>> [2].bat
vol %drive%: | find /n " " >> [2].bat
for %%v in (:v "for %%%%v in (1 2 3 4 5) do shift") do echo %%v>> [2].bat
echo echo.Volume in drive %drive% is: %%1 %%2 %%3 %%4 %%5 %%6>> [2].bat
set drive=
for %%v in (REM:edit REM:pause call erase pause cls) do %%v [2].bat
:end
|