I'm trying to create an ISO image containing several directories and files. The directory structure I'm trying to create in the ISO image is NOT the same as what is currently on my hard drive. This process will be done by another script, so it must be done with the command line.

Example hard drive format:


What I want the ISO image to look like:



According to the help page for the UltraISO command line arguments, I can pass -newdir dirname to create a new directory in the ISO image. I should also be able to use -chdir dirname to change directories, but it's unclear how this works and I can't seem to get it working right.

At the moment, I am just trying to make aFolder and put a.txt inside it. These are the commands I've tried with no luck.

  1. ultraiso -imax -l -newdir aFolder -chdir aFolder -f a.txt -output test1.iso

    This creates aFolder but places a.txt at the top-level (next to aFolder but not inside it).

  2. ultraiso -imax -l -newdir aFolder -output test2.iso followed by ultraiso -in test2.iso -chdir aFolder -f a.txt

    I thought that maybe the folder had to be created with one call, and then changed into the next, but this gives the same result as 1: a.txt is next to aFolder.

  3. ultraiso -imax -l -newdir aFolder -output test3.iso followed by ultraiso -in test3.iso -chdir aFolder and then ultraiso -in test3.iso -f a.txt

    Then I thought maybe there's something internal to the ISO that stores the current directory, and that a command has to set it before you can put files inside... Nope, same as 1 and 2.

  4. ultraiso -imax -l -newdir aFolder -f a.txt aFolder -output test4.iso

    Maybe I could do -f filename_on_disk filename_in_iso? Nope, this command doesn't even work: wrong parameter: aFolder.

So how can I make a directory in my ISO image and then place a file inside that directory? I would prefer to continue using UltraISO but I am open to other suggestions.


Sorry to answer my own question but I found the magic combination.

Commands seem to be parsed left-to-right in UltraISO. Also, when using the chdir option in UltraISO, the argument folder needs to be prefixed with a /. The path-structure is similar to Linux where / represents the root directory. So the command would to make an ISO of



would be:

ultraiso -imax -l -newdir aFolder -chdir /aFolder -f a.txt -chdir / -newdir bFolder -chdir /bFolder -f b.txt -output solution.iso

Logically, this is: Create an ISO image, make aFolder, change to aFolder, put a.txt here, change to base directory, make bFolder, change to bFolder, but b.txt here, save the entire image to solution.iso. I guess that makes sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.