armasmike
asked on
Diskpart script help
I have a txt file that has this
select disk 0
clean
create partition primary size=100
select partition 1
format quick fs=ntfs label="System"
assign letter=S
active
create partition primary
select partition 2
format quick fs=ntfs label="Windows"
assign letter=W
list volume
exit
And to run this as a script
i use diskpart.exe /s WipeC.txt
BUT i am booting of a usb with a label name "images"
This has only happen one time but my script wiped my usb because it was disk 0.
Is there a way to check if disk 0 is label "images" if it is DON'T wipe it.
select disk 0
clean
create partition primary size=100
select partition 1
format quick fs=ntfs label="System"
assign letter=S
active
create partition primary
select partition 2
format quick fs=ntfs label="Windows"
assign letter=W
list volume
exit
And to run this as a script
i use diskpart.exe /s WipeC.txt
BUT i am booting of a usb with a label name "images"
This has only happen one time but my script wiped my usb because it was disk 0.
Is there a way to check if disk 0 is label "images" if it is DON'T wipe it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have not learn PowerShell yet. it's on my bucket list but at this time can i output the diskpart info to a text file then use vbs to find out id Disk 0 is label name "images" if so DON'T Wipe it and stop.
You could run a diskpart script that just listed out the DISKs to a text file and then parse the textfile to decide what disk to wipe.