Script puzzle: Solving Hanoi … in shell

If you like CMD programming, here is a challenge for you: write a CMD batch file that solves the Hanoi problem. You start with these folders:

and you must end up with this state:


You probably know the rules of the Hanoi problem. Mapped in the command shell terminology these rules are as follows:
1) You can move one file at a time, and only between the Stack1, Stack2 and Stack3 directories.
2) After you move a file into a target directory, it should always appear first in the DIR command (that is, lexicographically, must be the first one).

Good luck!

Comments (3)

  1. other 110 (!!!) implementations of the Hanoi problem, here at Hanoimania:

Skip to main content