134 Managing partitions using GDisk
Performing multiple GDisk operations using batch mode
Performing multiple GDisk operations using batch
mode
Use the batch mode switch, /batch, to perform multiple GDisk operations with a
single command. Using the /batch switch lets you avoid loading GDisk from the
boot disk each time. Batch commands can either be supplied interactively at a
prompt or in a pre-prepared text file.
If the name of a text file is supplied along with the batch mode switch, GDisk
opens the file and executes the commands within it until all commands have been
executed or one of the commands encounters an error.
Note: To use the Windows version of GDisk in the example commands, replace
gdisk with gdisk32.
For example:
C:\> gdisk /batch:cmds.txt
If the batch mode switch is supplied without a file name, GDisk prompts for the
commands to execute.
Command-line arguments that apply to all of the batch commands can be
specified on the original command line along with the batch mode switch. The
lines found in the batch file (or typed at the prompt) are appended to the already
partially formed command line.
Following is a sample batch command file called Two-new.txt. Blank lines and
lines starting with the number (hash) symbol are considered comments. These
lines are ignored. (In this example, the commands do not specify the fixed disk on
which to operate.)
# delete all partitions
/del /all
# create formatted FAT16 primary DOS partition and then create an extended
# partition
/cre /pri /-32 /for /q
/cre /ext
# create formatted FAT16 logical DOS partition
/cre /log /-32 /for /q
The following command deletes all partitions and creates two new ones on the
second fixed disk with confirmation prompting turned off:
gdisk 2 /y /batch:two-new.txt