Skip to content
Home » Retro Computing » Write files to an img file in Windows

Write files to an img file in Windows

Creating an IMG file of a DOS disk from individual files isn’t something you have to do often, but when you do, it’s a bit of a hassle. But it’s doable. Here’s how to write files to an img file in Windows, which you can then read with a Gotek floppy emulator running Flashfloppy.

Write files to a virtual floppy .img from Windows

Gotek floppy emulator for retro PCs

You can create .img files on your modern PC for use in a Gotek upgraded with Flashfloppy with a free command line tool called Build Floppy Image from 2002.

There’s a GUI tool called IMGburn that does the job of writing files to virtual floppies, but it costs money.

Here’s a free command line tool called Build Floppy Image (BFI) that does the job. It was written in 2002 by Bart Lagerweij, a familiar name to veteran Windows sysadmins.

Put the executable, bfi.exe, somewhere in your path on your Windows 10 or Windows 11 machine, then you can use commands to build .img files that you can then load onto a USB stick and plug into a Flashfloppy-upgraded Gotek. You can build img files of varying formats, such as 1.44 megabytes for 286 and better systems, and 360K and 720K images for XT systems.

Here’s a command that creates a 360K IMG file named imga001.img and writes the contents of the directory c:\temp\staging to it.

bfi.exe -v -t3 -f=imga001.img c:\temp\staging

And here’s one to make a 720K image:

bfi.exe -v -t4 -f=imga001.img c:\temp\staging

Leave out the -v parameter to create a 1.44 megabyte image. You can run the command with no parameters to get the full list of available options.

What’s the point?

There are any number of ways to get files to older PCs. For transferring large numbers of files, I like to use a network connection.

For smaller number of files, if you are using compact flash or SD card storage, you can take the card out of the old computer, put it in your new computer, and write files straight to the card, then put the card back in your vintage PC. And I’ve done that any number of times, but sometimes the card is in the back of the machine and you have to move things around in order to reach it.

If I have a few hundred kilobytes worth of files, and they are something I am likely to want on another PC at some point anyway, creating an IMG file and putting it on a USB stick is sometimes a convenient option.
There’s overhead involved, sure, but if I’m using my new computer and find out about a useful DOS utility, like I did with FREESP, grabbing the utility, writing it to a floppy image on a USB stick, and then going to my vintage PC and plugging in the USB stick is probably faster than any of the other options.

Another cool thing about this tool is that it can create extended capacity images. This lets you put 1.68 MB worth of files on a high density disk image rather than the standard 1.44 megabytes.

If you found this post informative or helpful, please share it!

1 thought on “Write files to an img file in Windows”

  1. In Linux/Unix things you are mentioning are straight forward.
    The raw device such as a floppy or hard drive can be written to a file. That is first byte to last byte.
    if floppy is a something like /dev/fd0 or /dev/fda however it is named:
    cat /dev/fd0 > floppy_drive0_raw.bytes
    or use the dd command.
    dd if=/dev/fd0 of=floppy_drive0_raw.bytes maybe use some other options too.

    A hard drive or partitions on the disk can be copied to a file:
    cat /dev/hda > hard_drive_image.bytes
    could also be /dev/sda or some other device.
    entire device and partitions should be in the /dev directory. One partition might be a windows partition and other partition Unix or some operating system or anything.

    You can mount a image of a file system as a file using the loopback option with the mount command if I remember correctly. You wouldn’t do that with the entire disk image but with a partition containing a file system your unix installation supports which is all or nearly all common file systems.

    Windows often need special programs written to do common stuff in unix/linux.

Comments are closed.

%d bloggers like this: