How to Create a DiskPart Script
- 1). Click the Windows "Start" button and type "notepad" into the search text box. Press "Enter" to open the Windows text editor.
- 2). Activate the disk you want to partition on the hard drive. Add the following code to your script:
select disk 0
Each disk has a number. The primary drive is set as 0 and the next slave drive is set as 1. When you use the "select" command, the DiskPart utility runs all subsequent commands on that disk. - 3). Create the partition on the disk. The following code partitions the activated disk:
create partition primary size=10000
The size in the statement is in megabytes. In this example, the partition is set at 10,000 megabytes (10 gigabytes). - 4). Assign a volume letter. You use the "assign" command without any parameters to assign the next available letter to the volume. Add the following code to the script:
assign - 5). Save the file and add the ".bat" file extension. This lets you run the script file in the Windows command line or the MS-DOS shell on a computer that does not yet have Windows installed.
Source...