VOGONS

Common searches


First post, by pappyN4

User metadata
Rank Newbie
Rank
Newbie

How do I find out the current path of a batch file in DOSBOX? I've spent more than I would care to admit but any solutions i've found are for CMD.

Here's the original batch file to run the game.

@echo off 
E:
cd \DYNAMIX\REDBARON
gcd -nE:\DYNAMIX\REDBARON
E:

Here's my simplified version. Hardcoding of the path is bugging me.

@echo off 
gcd -nD:\REDBARON

The path has to be directly after the -n switch, no spaces.

gcd -n%cd%
gcd -n%~dp0
arent valid in dosbox

98/XP/XP64, ASUS A8V Deluxe, A64 3200 Venice [67W], 2GB DDR400, Ti4200 128MB [35W], M4 128GB SSD w/SATA-PATA
XP/XP64, GA-F2A68HM-HD2, A8-7600 [45W], 16GB DDR3-2133, Zotac GTX750 1GB passive [55W], 2TB SSD

Reply 1 of 3, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Could be tricky to do with only shell commands in a batch file, but rather easy with PC Magazine's STRINGS utility program.

There's more than one way it can be done, but this works:

@echo off
cd > pathfile
strings pathvar= READ pathfile,1
echo Current path is %pathvar%

Reply 2 of 3, by pappyN4

User metadata
Rank Newbie
Rank
Newbie

It works, thanks. Too bad you cant assign cd directly to a variable.

98/XP/XP64, ASUS A8V Deluxe, A64 3200 Venice [67W], 2GB DDR400, Ti4200 128MB [35W], M4 128GB SSD w/SATA-PATA
XP/XP64, GA-F2A68HM-HD2, A8-7600 [45W], 16GB DDR3-2133, Zotac GTX750 1GB passive [55W], 2TB SSD