To delete all mapped drives, you can use the following command:

net use * /d /y

If you want a record of what was mapped, or you need the ability to remap the drives later, you can use RemapAll.bat.

NOTE: See tip 3457 » How do I delete all the drives I have mapped with a Subst command?
NOTE: See tip 3491 » How do I extract the 'server' and 'share name' from a drive letter mapped by 'net use'?
NOTE: See tip 4161 » How can I run a script on client computers that requires a mapped drive if they don't have any available drive letters?

The syntax for using RemapAll.bat is:

RemapAll \[FileName\] \[/p\]


FileName optionally records the mapping and can be used to remap the drive letters.
/p is an optional parameter that causes the FileName remapping to be persistent.

RemapAll.bat contains:

@echo off
set file=^>nul
if \{%1\}<h1><a name="_goto_delete_set_dp_dp1_if_not_exist_dp_goto_syntax_set_file_1_if_2_">\{\} goto delete
set dp=%~dp1
if not exist %dp% goto syntax
set file=%1
if \{%2\}</a></h1>\{\} goto delete
if /i "%2" EQU "/p" set per=/PERSISTENT:YES&goto delete
@echo Syntax: RemapAll \[FileName\] \[/p\]
goto :EOF
if "^%file%" EQU "^>nul" goto doit
if exist %file% del /q %file%
set file=^>^>%file%
for /f "Skip=1 Tokens=*" %%i in ('net use * /d /y') do set line="%%i"&call :parse
goto :EOF
if not "%line:~2,1%" EQU ":" goto :EOF
set drive=%line:~1,2%
set Svrshr=%line:~17,99%
set svrshr=%svrshr:"=% %per%
@echo net use %drive% %svrshr%%file%