Fdisk Command Line Switches
I don't claim credit for discovering any of these. Use them at
your own risk!
These switches work with the FDISK that is included with Windows 95
OSR2 (MS-DOS 7.1). They also work with Windows 98.
CAUTION: Using FDISK to modify or delete partitions on a hard drive
renders all the data associated with
that partition unavailable.
To create partitions without going through the standard FDISK menus:
FDISK [/X] drive [/PRI:size] [/EXT:size] [/LOG:size] [/PRMT | /Q]
Summary of switches
-
<size> Partition size in Mb - FDISK rounds this number up
-
<disk> Harddisk number, e.g. first HD is number 1
/ACTOK
Do not check drive
integrity - this can improve the speed of Fdisk
/EXT:<size> <disk>
Creates an Extended
Partition. If <size> is larger than remaining free space, all free space
is used. That is, you
don’t have to know
the exact remaining size in order to use this switch.
/FPRMT
Allows you to use
Fat32 on a <520mb Hard Drive. (OEM & 98 ver. only)
/EXT:<size> <disk> /LOG:<size>
Creates a Logical
DOS Volume in the Extended Partition.
/MBR
Re-writes the Master
Boot Record based on the current disk structure (without altering the partition
table information).
This switch can be
used to repair a Master Boot Record that has been corrupted or damaged.
/PRI:<size> <disk>
Creates a Primary
Partition. If <size> is larger than the space on the HD all space is
used for the primary partition.
/PRMT
Prompts for action
/Q
Quiet - no messages
displayed during processing
/STATUS
Displays a summary of the
partition structure on all hard drives
/X
Ignores extended disk-access
support (LBA). This switch may be needed if disk access or stack overflow
errors occur
/xMBR
Recreate Master Boot
Record on specified disk(where x is the drive letter)
The undocumented switches (/PRI, /EXT, and /LOG) can be used from the
command line or in a batch file and could be
useful if a number of new drives are to be prepared similarly.
You can pipe keystrokes into FDISK using a file which contains the keystrokes
including <CR>.
Most editors can't insert the <CR> character without <LF> so
you need a hex-editor to do the job.
Example: FDISK /ACTOK < mycfg.txt