Hi Experts,
i am trying to format all the disk present in the pc excluding disk 0 in Winpe. so i am using the below given batch file script
@echo off
setlocal enabledelayedexpansion
setlocal enableextensions
:: Set an initial value for HDDcount to keep track of how many HDDs we have found.
set HDDCount=0
For /f "Skip=3 usebackq tokens=1,2,3" %%A in ( ^"PowerShell Get-PhysicalDisk ^| Select MediaType, DeviceID, FriendlyName"
) Do (
if %%A==HDD set /A HDDcount=HDDcount+1
if %%A==HDD call:HDD %%B %%C !HDDcount!)
:: All disks have been processed. Exit the batch file.
EXIT
:HDD
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: We arrive at the HDD routine if Get-PhysicalDisk indicates the disk is an HDD. :
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: If this is the first HDD that we have encountered, then we will set the disk label to
:: "Data". For each additional HDD, we will label them as "Data1", "Data2", "Data3", etc.
set /A ID=%3 - 1
if /I %ID% EQU 0 (
set DiskLabel=Data
) else (
set DiskLabel=Data%ID%
)
(
Echo select disk %2
Echo clean
Echo convert gpt
Echo create partition primary
Echo format quick fs=NTFS label="%DiskLabel%"
Echo assign
Echo exit
)|Diskpart
exit /b
but this batch file formats the Disk 0 also how we can stop the batch file from formatting the DIsk 0.
your help is much appreciated.
Thanks
Balaji S