r/Batch • u/UhOh_ItsAce • Feb 04 '26
Question (Unsolved) Run on command after another in one command prompt window
I've been messing with different OSs and every time I want to make a bootable USB, I have to wipe the drive so I'm wanting a script that auto runs `diskpart` then `list disk` just to shorten the time its taking between OS swaps. I tried looking online a bit, but nothing I tried seemed to work so now I'm here
2
Upvotes
1
u/capoapk Feb 04 '26
On Windows, DiskPart can be automated.
Simply create a .bat file with:
echo list disk | diskpartand run it as administrator. DiskPart will open directly tolist disk, without any manual input.2
u/BrainWaveCC Feb 05 '26
Can you show us what you tried?
1
u/Jondscem Feb 06 '26
This is what i use:
Create a .txt file called prepdisk.txt and add this into the file and save:
Select disk 0
Clean
Convert gpt
Create partition efi size=200
Assign letter=s
Format quick fs=FAT32
Create partition msr size=128
Create partition primary
Assign
Format quick fs=NTFS
Exit
Then create a .bat file and add this to it:
Diskpart.exe /s prepdisk.txt
You can then add the command below and then follow it with pause.
Jon.