- @echo off
-
- rem Get all disk information
- for /f "skip=1 tokens=1,2" %%a in ('diskpart /s list_disks.txt') do (
- set disk=%%a
- set info=%%b
-
- rem Check if the disk label is not "WinPE_UWT" and the disk is not X:
- if not "%info%"=="WinPE_UWT" if not "%disk%"=="X:" (
- rem Select the disk
- echo select disk %disk% > diskpart.txt
- echo clean >> diskpart.txt
- echo create partition primary >> diskpart.txt
- echo format quick fs=ntfs label="Windows" >> diskpart.txt
- echo assign letter=%disk% >> diskpart.txt
- diskpart /s diskpart.txt
- )
- )
-
- echo Disk format complete.
复制代码
|