0

I've been doing some mucking around with DOSbox lately, and one particular task I've been doing is setting up a series of batch files for calling things so that I can save a few cds. A typical .bat file might look like the following:

cd wolf3d
wolf3d -goobers
cd ..

One thing that's become a bit annoying is the lack of a built-in text editor that I can use, such as pico/nano. That said, I do have QBASIC installed, so one option I was considering was setting up so I could do a call such as the following:

nano filename.bat

and it would open up the file in QBASIC.

I've done a bit of reading on how batch scripting works, and it appears that just adding a %1 to the script should suffice, such as the following:

cd qbasic
qbasic %1
cd ..

What ends up happening, however, is if I type in, say nano nano.bat so I can edit the batch file, it ends up opening up a new, blank nano.bat file instead.

I've tried to look up what I'm missing here, but this seems to be a bit too arcane to locate easily. Can anyone point out what's missing here?

Thanks!

Kaji
  • 249

2 Answers2

1

To elaborate a bit more as in my comment:

  • If passing a relative path as an argument to a batch which itself changes the current folder will fail if the pass isn't relative to the new folder.
  • Alternatively pass an absolute pass
  • or don't change the current folder if not absolutely necessary. Qbasic is a standalone .exe file which can be somewhere reachable via the path. To use it as an editor there is an /Editor option (just checked it in VDOS Plus - a DosBOX derivate)

So change your nano.bat to

@Qbasic.exe /Editor %1

provided Qbasic.exe is reachable via a folder in the path.

LotPings
  • 7,391
0

Try double percents ie %%1. Batch files in dos do not quite follow the same rules for parameters as their dos shell equivalents.