|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DISKPART select command doesn't have a "noerr" command for scriptiI'm not sure how many partitions the drive has. I thought the script below would work, but if any of the partitions don't exist, the script stops execution when trying to select them. This is because there is not a "noerr" parameter for selecting the partitions. I don't understand what good the "noerr" parameters are when you have to select items first, and the select function has no "noerr" parameter so it fails???: BTW: I cannot use "clean" (please don't ask why) select disk 0 select partition 1 delete partition noerr select partition 2 delete partition noerr select partition 3 delete partition noerr select partition 4 delete partition noerr select partition 0 delete partition noerr select disk 0 create partition primary size 2000 format FS=FAT LABEL="PARTITION1" QUICK assign letter d create partition extended create partition logical format FS=NTFS LABEL="PARTITION2" QUICK assign letter c Active Exit Thanks, -- Bill Baker
Show quote
Hide quote
"WB" <W*@discussions.microsoft.com> wrote in message I don't know anything about diskpart.exe but you could walk around the news:D3618F52-6C8F-4239-A240-86E2AFDB2571@microsoft.com... > I'm trying to programmatically delete all partitions from a drive, however > I'm not sure how many partitions the drive has. > > I thought the script below would work, but if any of the partitions don't > exist, the script stops execution when trying to select them. This is > because > there is not a "noerr" parameter for selecting the partitions. > > I don't understand what good the "noerr" parameters are when you have to > select items first, and the select function has no "noerr" parameter so it > fails???: > > BTW: I cannot use "clean" (please don't ask why) > > select disk 0 > select partition 1 > delete partition noerr > select partition 2 > delete partition noerr > select partition 3 > delete partition noerr > select partition 4 > delete partition noerr > select partition 0 > delete partition noerr > select disk 0 > create partition primary size 2000 > format FS=FAT LABEL="PARTITION1" QUICK > assign letter d > create partition extended > create partition logical > format FS=NTFS LABEL="PARTITION2" QUICK > assign letter c > Active > Exit > > Thanks, > -- > Bill Baker problem by using this batch file to automate the job. @echo off echo> diskpart1.scr select disk 0 echo>>diskpart1.scr list partition echo>>diskpart1.scr exit diskpart < diskpart1.scr | findstr /i "primary logical" > diskpart.txt echo>diskpart2.scr select disk 0 > diskpart2.scr for /F "tokens=1,2" %%a in (diskpart.txt) do ( echo>>diskpart2.scr %%a %%b echo>>diskpart2.scr delete partition noerr ) echo>>diskpart2.scr select disk 0 echo>>diskpart2.scr create partition primary size 2000 echo>>diskpart2.scr format FS=FAT LABEL="PARTITION1" QUICK echo>>diskpart2.scr assign letter d echo>>diskpart2.scr create partition extended echo>>diskpart2.scr create partition logical echo>>diskpart2.scr format FS=NTFS LABEL="PARTITION2" QUICK echo>>diskpart2.scr assign letter c echo>>diskpart2.scr Active echo>>diskpart2.scr Exit diskpart < diskpart2.scr
What is error '80041003', please?
querying wmi - recommended structure when iteration seems unnecessary? accesschk script to include datestamp managing NTFS permissions - cacls or wmi? Simple Ping Script How can I do a WMI Bulk data retrieval ? chech group User on the system Start up Problem calling oADsSecurityUtility.SetSecurityDescriptor from VBScript Net send over different domains |
|||||||||||||||||||||||