I need to make a batch file that can be called from autoexec.bat that will make 1 5GB NTFS partition. After this action I'm going to be installing Windows XP SP2 fully automated. Therefore I need to just insert a single CD and have it do all of this.
So far I do have an idea on how the batch file would work but I'm not exactly sure how ERRORLEVEL works, especially after a computer restarts (Such as after FDISK is executed). What I need is for this batch file to make the partition, and set it as active (Probably using FDISK) and then format it (Using FORMAT), but not have a continuous loop of it formatting every time it starts and therefore it would need to check to see if it has already fdisk'd and formatted. Also, a plus would be to delete all partitions at the beginning. Reference my code snippet for what I'm thinking thus far for a batch file. One big thing is I don't know 100% how ERRORLEVEL would work because if you restart your computer, I'm not sure if all variables (ERRORLEVELs) are stored in memory (Volatile) or on the HDD (Non-volatile) or however it works.
In essence, if there isn't a 5GB NTFS partition, this batch file will delete everything on the disk, make a 5GB primary partition, set it as active, restart (If necessary), format the partition, then begin an automated installation of Windows XP SP2 with NO USER INTERACTION NECESSARY. This disk is meant to be fully automated.
*****Also, I'm not going to be using any 3rd party programs such as GDISK, delpart, etc. I will be doing this using ONLY what Windows provides.
IF NOT ERRORLEVEL 1 goto delete
IF ERRORLEVEL 1 goto part
IF ERRORLEVEL 2 goto format
IF ERRORLEVEL 3 goto end
<Delete all current partitions>
<Somehow return a 1?>
<Make a 5GB primary partition>
<Set that partition as active>
<Somehow return a 2?>
<Format the partition as NTFS>
<Somehow return a 3?>