1. Takes the current Disk 0 drive and shrinks the C drive to 50% of total volume
2. Splits the remaining space between drive letters M and N equally.
This has to be done via percentages because the local drives will be different densities.
A similar script is found in these threads and is close to what I need:
http://www.msfn.org/...iple-partition/
http://www.msfn.org/...kpart-question/
@echo off
setlocal enabledelayedexpansion
echo list disk>%temp%\listdisk.dp
diskpart /s %temp%\listdisk.dp >%temp%\disklist.dat
if exist %temp%\mkdisks.dp del %temp%\mkdisks.dp>nul
for /f "tokens=1-4 delims= " %%a in ('find /v "###"^<%temp%\disklist.dat^|find " Disk "') do (
set size=%%d
if !size! LSS 1024 set /a size=!size!*1024
set cdrv=18432
for /l %%s in (18432,-4096,4096) do if !cdrv! gtr !size! set cdrv=%%s
echo select %%a %%b >>%temp%\mkdisks.dp
echo create partition primary size=!cdrv! NOERR >>%temp%\mkdisks.dp
echo assign letter c NOERR >>%temp%\mkdisks.dp
echo active >>%temp%\mkdisks.dp
set /a size=!size!-!cdrv!
set /a ddrv=!size!/10
set /a ddrv=!ddrv!*8)
if !ddrv! GTR 0 (
echo select %%a %%b >>%temp%\mkdisks.dp
echo create partition primary size=!ddrv! NOERR >>%temp%\mkdisks.dp
echo assign letter d NOERR >>%temp%\mkdisks.dp
set /a edrv=!size!-!ddrv!
if !edrv! GTR 0 (
echo select %%a %%b >>%temp%\mkdisks.dp
echo create partition primary NOERR >>%temp%\mkdisks.dp
echo assign letter e NOERR >>%temp%\mkdisks.dp)
) else (
echo select %%a %%b >>%temp%\mkdisks.dp
echo create partition primary NOERR >>%temp%\mkdisks.dp
echo assign letter d NOERR >>%temp%\mkdisks.dp))
endlocal
diskpart /s %temp%\mkdisks.dp
This code creates a diskpart script, called mkdisks.dp.
First, a "C:" partition with a max of 18GB to a min of 4GB in 4GB increments, depending on the amount of hard disk space, is added to the diskpart script.
The remaining space is split to 80% for the "D:" partition, and the remaining to the "E:" partition.
Basically I need help modifying that meet my requirements. Any tips?



Help
Back to top









