In Windows, FDisk has been replaced by DiskPart. “DiskPart commands help you to manage your PC’s drives (disks, partitions, volumes, or virtual hard disks). Before you can use DiskPart commands, you must first list, and then select an object to give it focus. When an object has focus, any DiskPart commands that you type will act on that object.” — (Microsoft TechNet).
For example, to create a single primary partition covering the whole second drive, format it as NTFS, label the partition “Virtual Machines” and assign it drive letter E using DiskPart:
list disk select Disk 1 list partition create partition primary list partition format fs=ntfs label="Virtual Machines" quick list volume assign letter=e
For example, to create another primary partition on the first disk using all of the available disk space, format is as NTFS, label it as Temp and assign it drive letter F using DiskPart:
select Disk 0 list partition create partition primary format fs=ntfs label="Temp" quick list volume assign letter=f
For example, here’s a script that wipes a disk and then creates a 500 MB partition:
select disk 0 clean convert gpt create partition primary size=300 format quick fs=ntfs label="Tools" assign letter="T"
“Use Diskpart /s to run scripts that automate disk-related tasks, such as creating volumes or converting disks to dynamic disks. Scripting these tasks is useful if you deploy Windows by using unattended Setup or the Sysprep tool, which do not support creating volumes other than the boot volume. To create a Diskpart script, create a text file that contains the Diskpart commands that you want to run, with one command per line, and no empty lines. You can start a line with REM to make the line a comment.
When using the DiskPart command as a part of a script, we recommend that you complete all of the DiskPart operations together as part of a single DiskPart script. You can run consecutive DiskPart scripts, but you must allow at least 15 seconds between each script for a complete shutdown of the previous execution before running the DiskPart command again in successive scripts. Otherwise, the successive scripts might fail. You can add a pause between consecutive DiskPart scripts by adding the timeout /t 15 command to your batch file along with your DiskPart scripts.
When DiskPart starts, the DiskPart version and computer name display at the command prompt. By default, if DiskPart encounters an error while attempting to perform a scripted task, DiskPart stops processing the script and displays an error code (unless you specified the noerr parameter). However, DiskPart always returns errors when it encounters syntax errors, regardless of whether you used the noerr parameter. The noerr parameter enables you to perform useful tasks such as using a single script to delete all partitions on all disks regardless of the total number of disks.” — (Microsoft TechNet).
To run a DiskPart script, at the command prompt, type the following command, where scriptname is the name of the text file that contains your script:
diskpart /s scriptname.txt
To redirect DiskPart’s scripting output to a file, type the following command, where logfile is the name of the text file where DiskPart writes its output:
diskpart /s scriptname.txt > logfile.txt