xponard Posted January 4, 2008 Share Posted January 4, 2008 (edited) Hello there,I am working with WinPE 2.0 and ImageX over USB Flash Disk trying to deploy HII XP SP2 image over multiple different computers.I want to use a script that perform disk partition/format (using diskpart.exe /s myscript.txt) before deploying the image (imagex.exe /apply ...)I need 3 partitions in this exact order :C: [sYSTEM] 12GoD: [DATA] all_of_free_spaceZ: [MSI] 6GoI juste want to know how to script this need.?How to calculate automaticaly the all_of_free_space that is = Total Capacity - (12Go+6Go)A simple way might be to create the partitions in this order: C(12)/Z(6)/D(no parameter, so all the free space) but I really would like to get the C/D/Z order...Thanks in advance XP Edited January 4, 2008 by xponard Link to comment Share on other sites More sharing options...
hj_fr Posted January 6, 2008 Share Posted January 6, 2008 I don't know if you can calculate freespaceYou must alwsay specify the size. Link to comment Share on other sites More sharing options...
xponard Posted January 7, 2008 Author Share Posted January 7, 2008 (edited) ok, I have found a solution based on the Scr1ptW1zard's answer : http://www.msfn.org/board/Diskpart-question-t108302.html> @echo offREM =====================================REM Script de partitionnement du disque 0REM Utilisation sous WinPE2.0/ImageXREM C[12Go]/D[Total-(12+6)]/Z[6Go]REM XP - 01/08REM =====================================setlocal enabledelayedexpansionecho list disk>%temp%\listdisk.dpdiskpart /s %temp%\listdisk.dp >%temp%\disklist.datif exist %temp%\mkdisks.dp del %temp%\mkdisks.dp>nulfor /f "tokens=1-4 delims= " %%a in ('find /v "###"^<%temp%\disklist.dat^|find " Disk "') do (If %%b EQU 0 ( set size=%%d if !size! LSS 1024 set /a size=!size!*1024 set /a ddrv=!size!-18432 echo select disk 0 >>%temp%\mkdisks.dp echo clean >>%temp%\mkdisks.dp echo create part pri size=12288 >>%temp%\mkdisks.dp echo select part 1 >>%temp%\mkdisks.dp echo active >>%temp%\mkdisks.dp echo assign letter=c: >>%temp%\mkdisks.dp echo format fs=ntfs label="SYSTEM" quick >>%temp%\mkdisks.dp echo create part pri size=!ddrv! >>%temp%\mkdisks.dp echo select part 2 >>%temp%\mkdisks.dp echo assign letter=d: >>%temp%\mkdisks.dp echo format fs=ntfs label="DATA" quick >>%temp%\mkdisks.dp echo create part pri size=6144 >>%temp%\mkdisks.dp echo select part 3 >>%temp%\mkdisks.dp echo assign letter=z: >>%temp%\mkdisks.dp echo format fs=ntfs label="MSI" quick >>%temp%\mkdisks.dp))endlocaldiskpart /s %temp%\mkdisks.dpGreetings.XP.diskpart_dynamique_valid_xp.cmd Edited January 7, 2008 by xponard Link to comment Share on other sites More sharing options...
DonDamm Posted January 7, 2008 Share Posted January 7, 2008 Nicely done. I was going to suggest that you have the script calculate remaining space and then subtract the 6GB from it and use the result as the second or D parameter. You beat me to it! :^) Note that the formatting is the Quick mode and good for most situations. If you want to do a full format for some reason, you'd need to change the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now