I am trying to creating batch file. How to use user input in selecting partition no? I want to format some partitions only using diskpart
. I already learn how to select disk number but I want to learn select partition number also. Sometimes partition number changed. So how can I user input for selecting partition number?
I am doing below now. But I want at time of selecting partition, it should ask me to select partition number also, but how?
@echo off
cd /d"%~dp0"
rem == List Disk and List Partitions ======================
echo >diskpart.txt List Disk
diskpart /s diskpart.txt
set /p Disk=Please enter the disk number:
if "%Disk%"=="" goto :eof
echo > diskpart.txt Select disk %disk%
echo >> diskpart.txt list partition
diskpart /s diskpart.txt
echo ============= Please check your Disk and all Partition numbers before continue =============
pause
rem == List Disk Again for Final Confirmation ======================
echo >diskpart.txt List Disk
diskpart /s diskpart.txt
set /p Disk=Please enter the disk number:
if "%Disk%"=="" goto :eof
echo > diskpart.txt Select disk %disk%
rem == 1. Format System partition ======================
echo >> diskpart.txt select partition 1
echo >> diskpart.txt format quick fs=fat32 label="System"
rem == 2. Format Windows partition ========================
echo >> diskpart.txt select partition 3
echo >> diskpart.txt format quick fs=ntfs label="Windows"
rem == 3. Format Recovery tools partition ================
echo >> diskpart.txt select partition 4
echo >> diskpart.txt format quick fs=ntfs label="Recovery"
echo >> diskpart.txt list partition
diskpart /s diskpart.txt
pause