# automatic fdisk and format



## fantomcat (Jun 3, 2005)

hi, is there a way to make a batch file to use fdisk?
what id like it to do is:

delete any possible partitions on the hard drive,

then set up a primary , active partition using the full 100% of the 
HDD, and the format c:

is this possible?


----------



## Tumbleweed36 (Feb 13, 2004)

Hi,

What I would recommend is that you download a boot disk from Bootdisk.com, and then just do the fdisk from that. If you need help with the Fdisk and how to do the rest of your question, please let us know and we will walk you through it.


----------



## Bob Cerelli (Nov 3, 2002)

Without knowing what partitions, how many there may be, or what file systems may be on the hard drive, I'm not aware of an automatic way to do this with FDISK.

Information on how to use FDISK can be found at:
http://www.onecomputerguy.com/install/fdisk.htm

Topics covered are:
Overview and Getting Started
Partitioning a New Drive - Single Large Partition
Partitioning a New Drive - Multiple Partitions
Deleting a Single Partition
Deleting Multiple Partitions
Deleting a NTFS Partition
Fixing the Master Boot Record


----------



## JohnWill (Oct 19, 2002)

You can batch an FDISK and FORMAT without a problem, the only issue is clearing all the previous partitions. Of course, there's a boot between the FDISK and format, so some trickery with the AUTOEXEC.BAT will be requited to sequence the process. I'm pretty sure I've seen several small DOS applications that will nuke the partition table, which will clear out any previous partitions. I'm not inclined to search out the utility to clear the partition table, but I believe it's quite possible. 

Another option would be a batch of something like Partition Magic or other similar utility.


----------



## Bob Cerelli (Nov 3, 2002)

Other than manually running FDISK and FORMAT, are there any specifics on this.

But I did just figure out how to automatically format.

Create a file called "yes" - the name really doesn't matter.
Have it be Y with a carriage return
Then a batch file like "format /v:lable c: < yes" will automatically start the format and not prompt you to press the Y key.


----------



## Bob Cerelli (Nov 3, 2002)

There is also a program called GDISK that can delete and create partitions and format them from a batch file.

You can use switches like "/del /all" to delete all partitions
You can use switches like "/cre /pri" to create primary partitions


----------



## fantomcat (Jun 3, 2005)

Thank you so much for you help, i havent tried gdisk yet but i will, im busy just now but ill try it before the weekends over, keep an eye out, cos ill get back to you and let you know how i got on, steve


----------



## Bob Cerelli (Nov 3, 2002)

If you need a copy with a text instructions, send me and e-mail and I'll send it you.


----------



## Bob Cerelli (Nov 3, 2002)

For example, you can delete all partitions (even extended NTFS), create a new one and format it as FAT32 all in a two line batch file:

Gdisk 1 /y /del /all
Gdisk 1 /cre /pri /for /q /v:label 

Takes just a few seconds. Hopefully this is exactly what you are looking for.


----------

