batch-filedoscddosboxturbo-c

Current directory in DOSBox [Optional: Using TURBO C]


I want to run a command in a specific directory and then return back. (There is a reason for it [validity of parameters...]).

I tried doing it in batch file for DOSBox...

@echo off
cd>cd.cd
cd %mypath%
dosomething 1 2 3
::I am not sure....
cd (type cd.cd) 

%CD%, %dI, FOR loop nothing works in DOSBox...

I wrote a C program but couldn't find a function that returns the current directory for TURBO C 16-bit...

Can someone please help me out with this?


Solution

  • %CD% is a variable in Windows cmd so you can't use it in MS-DOS. You can work around that by storing the current directory output from the cd command without any parameters into a variable by redirecting command output to file then read the file from disk

    Get current dir