Dosbox dos script

Bryan Butler
Bryan Butler used Ask the Experts™
on
I’m working on a dos script that will loop through the files in a given folder and run a command on each file in the folder.  It also needs to copy the output of the command, which is a file named dump-hac.txt, to the original file’s name. Also MUST BE FULL SCREEN DOS or DOSBox dos.

Pseudo code:
For %a in (“*.hac”) do
   dump-hac.exe %~na
   mv dump-hac.txt %~na.txt

This is the base code of a script that runs on a newer dos version, but Dosbox (http://en.wikipedia.org/wiki/DOSBox) doesn’t have “for” or other abilities.

The main reason for all this is that this program ONLY runs in FULL SCREEN DOS mode.  I need to automate running it in another script and it seems impossible with the new Vista/Win7 dos, and it’s looking the same in XP dos.  So I found it does run in DOSBox and now I’m trying to figure out the dosbox dos commands to do it.  Help?  TIA.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
More info:

The %~an takes the base of the files name (ex. 244543 if the filename is 244543.hac).  So the command calls "dump-hac.exe 244543" and the "move" does the same type of thing: "mv dump-hac.txt 244543.txt"
Have you tried creating a .pif shortcut pointing to your batch that has the "Full screen" option enabled?

Author

Commented:
I hadn't tried it.  I'm trying now, but I can't figure out how to pass the command line arguement.  Help?
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Well, your batch should look pretty much the same as before, like below.  The only thing you are doing different is pointing your .pif file to that batch.  Make sure it is a .pif file and not a .lnk file.  
for %%a in (*.hac) do (
   dump-hac.exe %~na
   mv dump-hac.txt %~na.txt
)

Open in new window

Author

Commented:
I figured out the PIF part; I needed to add the parameter on the "command line" and change the "working" to the folder with the files I wanted to use.  AND IT WORKS!  I'll see if I can work it into a script.  I'll have to create the PIF file each time as in:

pif file "command line":
c:\dump-hac.exe 13030553

The 13030553 is the file I want to operate on, so I need it to change each time.  Help?  

Also, the thing is, this is "DOSBox" dos, which is pre-win98 basically.  So the "for" and other things won't work, BUT if I can figure out changing the PIF file "command line", then I CAN use this script as it seems to be the work-around for the "full screen" issue.

Author

Commented:
I'll open another question for the "changing the command line in the pif" part.  Your suggestion of a PIF is a workaround so I can run this on XP, and this means I hopefully won' t have to use DOSBox.
OK.  Ive never used DOSBox, and Im still not sure why you need it if you use XP.  You should just be able to point the .pif file to your batch file and make it full screen.  That way, you can use the for statement for your looping throught files.
Try putting  this in the command line part of the .pif properties.

cmd /c <pathtoyourbatchfile>

Also make sure that the working dir is set properly.

The contents of the batch file should be as we have above.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial