Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have to delete and create partitions with fdisk at a number of pcs. (always the same).
(I use a MS-DOS 6.22 Bootdisk.)
So I tried to make a txt file to control fdisk.
It seems to work until fdisk asks me to hit the ESC key.
How can I "write" the ESC Command in a txt file?thanks in advance for any help
uli

I wrote some BATs for w98 DOS [even though some here we tell you ad nauseum that it does not exist] which might work in 6.22 with some tweaking.
The relevant lines are:
if %1!==! FDISK 1/PRI:22222
if not %1!==! FDISK 1/PRI:%1If no parameter is passed, it creates a primary partition of size 22222. If the disk is smaller than the 22222 it uses total capacity.
In 6.22 it may not 'roll back' to 2048, so you mau need to hardwire it.
I also have a BAT to nuke existing partitions, if you need it.
HTH
M2
If at first you don't succeed, you're about average.

Thanks M2
I can also use the Win98 Dos Version.
I need the BAT to nuke existing Partitions also.What I have to do is:
Delete 3 partitions
Create a partition
format the HDDeleting 3 partitions with fdisk is not funny
all the time.uli

Hi uli,
Put this into a text file; let's call it nuke.d:
::== nuke.d
f 200 L200 0
a 100
mov ax,301
mov bx,200
mov cx,1
mov dx,0080
int 13
int 3d 100 LF
g=100
q::== make sure that there is a blank line [enter] below the q ; or else debug will hang
Then in your BAT to wipe all partitions:
debug < nuke.d
WARNING: this is not a toy. It will wipe out everything on the first, or only, IDE HD.
HTH
M2
If at first you don't succeed, you're about average.

Hi M2
Thank you very much. It works perfect.
Thats what I need. :-))
I don“t really understand how it works.
Only that it overwrites data from Adress 200 with 0.
So any information is lost.Uli

Hi uli,
It uses BIOS to write to absolute disk sectors.
It writes 0s to the first 200 hex [512 decinal] bytes. That's where the partition table is.
[was]
M2
If at first you don't succeed, you're about average.

Hi Mechanix2Go
I see that this thread is fairly recent. Which is good :). Ok, well I found this site searching for something regarding an FDISK automation, and found your partionion nuker, I copied it into a text file and booted up old faithful virtual machine, ran it and it worked, however it gives me a bad partition table when I try format the drive. Do I still need to use fdisk to partion it? If so, how would I get a working fdisk script? Mine hangs after creating partition.Maybe doing something wrong :(
... Ahh yes, but is it art?

Hi M D,
As mentioned above, the different versions of fdisk may behave differently.
What version are you using and where does it hang?
M2
If at first you don't succeed, you're about average.

Hi Mechanix2Go
Well, fdisk hangs when I try use a script. It goes in and does it's then, but doesn't exit fdisk like it should. the FDISK version is what comes with Dos 6.22. I thought that I could maybe use the partition nuker to nuke all drives and then format without rebooting. But it doesn't seem to work :(. It does however give me an error before it starts tho. Below is the out put:
::== nuke.d
^ERROR
f 200 L200 0
a 100
mov ax,301
mov bx,200
mov cx,1
mov dx,0080
int 13
int 3d 100 LF
g=100
q::==
I tried using an alternative to normal fdisk called ffdisk and the script also hangs it. but I can go in and do it manually whereas the dos 6.22 version of fdisk just doesn't go in. :(.
... Ahh yes, but is it art?

Hi M D,
I'm not with you.
First you need to remove all partitions like this:
debug < nuke.d
Can you get that far?
M2
If at first you don't succeed, you're about average.

Hi
Yeah the script runs and removes all partitions. Then when I try and format it says "Invalid partition table".
Then I try running fdisk >fdisk.txt which contains the script to recreate a partition and it hangs at the end. Sorry for it being so confusing.
... Ahh yes, but is it art?

"Then I try running fdisk >fdisk.txt which contains the script"
That is not what you need. You need this BAT:
::== makepart.bat
if %1!==! FDISK 1/PRI:22222
if not %1!==! FDISK 1/PRI:%1
fdisk /status
::== endReboot before attempting to format the new partition.
M2
If at first you don't succeed, you're about average.

Maybe using something like ghost would be more productive partition and install the software in one step.

Sorry I am a bit late, have been on holidays. :-))
With FDISK in MS-DOS 6.2 you can only make 2GB Partitions:
FDISK 1/PRI:2222
then reboot and
format c:My "new" question: Is it possible to pick up the following line of a Batch-Script after a reboot? (That I can make a partition and format it in one Script.)
uli

Hi uli,
Well, to let the BATCH know what stage it's at and have it go to the
appropriate step, you need to "leave a marker".Something like this:
::== your.bat
if exist nuked goto :makepart
if exist partmade goto :format
:: == here's the nuke section
nuke
type nul > nuked
goto :eof
:: ==
:nuked
del nuked
:: == here's your makepart section
makepart
type nul > partmade
goto :eof
:format
del partmade
format:eof
M2
If at first you don't succeed, you're about average.

Hi M2,
thank you very much. Now it works.
nukes
creates
reboot
formatall in one batchfile. That save me lots of time and nerves. ;-)
uli

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |