VOGONS


First post, by mike_canada

User metadata
Rank Member
Rank
Member

I have a dell wyse mini thin client with a 128MB flash drive which I can setup dos on, but most of the time I want it to use it as a specialized hide-away server because it interacts with my custom hardware which connects to that computer through a serial port. Yes, I'm a tech at that.

Now in order for the serial port to be of use, the drive needs to have DOS on it with custom software I built for it. All software and such is taken care of, but I need help with the automation because I won't be always connecting a monitor or keyboard to the thin client, but I will carry my external usb CD drive which I can use to boot the system.

What I have trouble with the most is being able to partition and format the flash drive with the most automation possible in DOS 6.22.

The closest I got with partitioning the drive automated is this command:

fdisk 1 /pri:999
fdisk /status

That allows me to make a partition of the maximum size despite 999 (MB) exceeding the drive space but I don't know if its correct But I don't want to execute fdisk if the drive exists but dos reports a media error when I do something with the drive (like a dos dir for instance)

The closest I got with formatting the drive automated is this command:

format c:/u/s

But that command still has format ask me if I want to continue.
I have also tried the /y switch suggested on some forums and the format command didn't like it.

Somehow I gotta get those two commands automated so that if the system breaks down, then all I need in order to recover the system is just the boot CD in the external CD drive connected to the dell thin client. I don't want to have to carry a keyboard or monitor and attach them both to the unit every time I want to repair it.

And for people wondering what else this machine will do? It will act as an HTTP server so I can access pages from any remote computer.

Any ideas how I can automate the DOS FDISK and FORMAT commands so that an unformatted and unpartitioned drive is automatically setup so maximum space is available and accessible in DOS?

Reply 1 of 3, by doshea

User metadata
Rank Member
Rank
Member
mike_canada wrote on 2020-12-30, 15:28:

But I don't want to execute fdisk if the drive exists but dos reports a media error when I do something with the drive (like a dos dir for instance)

I don't understand, are you saying you want to do some kind of check before you run FDISK?

In any case I don't know if the commands you're using are "correct", I suppose if they work then that's good enough. As an alternative maybe you could try using the SCANCODE tool I describe in the thread Scripted/Automated Installs for DOS CD-ROM games (e.g. Id's DEICE) to automatically interact with FDISK. I tried passing input to FDISK the way I describe below for FORMAT but it didn't seem to work, so maybe you could try SCANCODE. If you try it I'd be interested in the results as I'd like to use it too! I have some automation I use for emulated machines where I use Linux's fdisk instead but I'd like to change to use DOS FDISK.

The closest I got with formatting the drive automated is this command: […]
Show full quote

The closest I got with formatting the drive automated is this command:

format c:/u/s

But that command still has format ask me if I want to continue.

You can get around the "Proceed with Format (Y/N)?" prompt by sending FORMAT the "y" on its standard input using redirection/pipelines.

Option 1:

echo y | format c:/u/s

This is using a "pipeline" of two commands, and under DOS that results in a temporary file or two being written to disk. Maybe that won't work if you've booted from a CD because the CD is read-only? If so the other option shouldn't require this:

Option 2:
Put a file containing the "y" on your CD or whatever when you're creating it:

echo y > y.txt

Then pass the contents of that file to format's input:

format c:/u/s < y.txt

Those are both examples of redirection, and you can think of it like the data flows in the direction that the greater-than or less-than sign is "pointing", either from a command's output to a file in the case of ">" or from a file to a command's input in the case of "<".

This pipeline and redirection stuff works the same in Unix except that pipelines don't tend to result in temporary files being created there.

One more problem you'll find with this FORMAT is that it'll ask you for a volume label at the end. You can pass a parameter like /V:MYDISK to make that go away.

Reply 2 of 3, by darry

User metadata
Rank l33t++
Rank
l33t++
doshea wrote on 2021-02-27, 05:01:
I don't understand, are you saying you want to do some kind of check before you run FDISK? […]
Show full quote
mike_canada wrote on 2020-12-30, 15:28:

But I don't want to execute fdisk if the drive exists but dos reports a media error when I do something with the drive (like a dos dir for instance)

I don't understand, are you saying you want to do some kind of check before you run FDISK?

In any case I don't know if the commands you're using are "correct", I suppose if they work then that's good enough. As an alternative maybe you could try using the SCANCODE tool I describe in the thread Scripted/Automated Installs for DOS CD-ROM games (e.g. Id's DEICE) to automatically interact with FDISK. I tried passing input to FDISK the way I describe below for FORMAT but it didn't seem to work, so maybe you could try SCANCODE. If you try it I'd be interested in the results as I'd like to use it too! I have some automation I use for emulated machines where I use Linux's fdisk instead but I'd like to change to use DOS FDISK.

The closest I got with formatting the drive automated is this command: […]
Show full quote

The closest I got with formatting the drive automated is this command:

format c:/u/s

But that command still has format ask me if I want to continue.

You can get around the "Proceed with Format (Y/N)?" prompt by sending FORMAT the "y" on its standard input using redirection/pipelines.

Option 1:

echo y | format c:/u/s

This is using a "pipeline" of two commands, and under DOS that results in a temporary file or two being written to disk. Maybe that won't work if you've booted from a CD because the CD is read-only? If so the other option shouldn't require this:

Option 2:
Put a file containing the "y" on your CD or whatever when you're creating it:

echo y > y.txt

Then pass the contents of that file to format's input:

format c:/u/s < y.txt

Those are both examples of redirection, and you can think of it like the data flows in the direction that the greater-than or less-than sign is "pointing", either from a command's output to a file in the case of ">" or from a file to a command's input in the case of "<".

This pipeline and redirection stuff works the same in Unix except that pipelines don't tend to result in temporary files being created there.

One more problem you'll find with this FORMAT is that it'll ask you for a volume label at the end. You can pass a parameter like /V:MYDISK to make that go away.

AFAICR, the semi-documented /autotest option for the format command will start formatting without asking any questions .

EDIT: My memory was accurate, it seems . See http://secrets.mysfyts.com/index.asp?Page=Format

Reply 3 of 3, by doshea

User metadata
Rank Member
Rank
Member
doshea wrote on 2021-02-27, 05:01:

As an alternative maybe you could try using the SCANCODE tool I describe in the thread Scripted/Automated Installs for DOS CD-ROM games (e.g. Id's DEICE) to automatically interact with FDISK. I tried passing input to FDISK the way I describe below for FORMAT but it didn't seem to work, so maybe you could try SCANCODE. If you try it I'd be interested in the results as I'd like to use it too! I have some automation I use for emulated machines where I use Linux's fdisk instead but I'd like to change to use DOS FDISK.

I used SCANCODE to automate MS-DOS 6.22's FDISK and it seems to work under emulation. Here's a fragment from my batch file:

scancode WaitForText 18,5 "Enter choice: [1]", Enter
scancode WaitForText 5,21 "Create DOS Partition or Logical DOS Drive", Enter
scancode WaitForText 9,5 "Do you wish to use the maximum available size", Enter
scancode WaitForText 14,5 "System will now restart", Enter
fdisk
echo ERROR: FDISK didn't reboot!
scancode /uninstall
goto end

I noticed that this version of FDISK doesn't seem to do any disk checks. I'm not sure when that was introduced, but I seem to recall Windows 95 or 98's FDISK having a fairly slow disk check that occurred a few times during the procedure, so probably to support that version of FDISK you'd need to wait for some different text to appear on the screen, or else wait for a combination of strings to be on the screen if the tool supports that.

I seem to recall also that older versions of FDISK didn't have the same defaults, or defaults at all (you might have needed to enter the partition size, for example?), so they'd probably need to be scripted differently too.