Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

CD environment variable (Users)

posted by bencollver Homepage, 10.03.2026, 02:29

Windows has a CD environment variable for the current working directory.

https://ss64.com/nt/syntax-variables.html

I came up with a couple of ways to set this variable on DOS.

Below is one that uses DEBUG.COM to edit SETCD.BAT

C:\>type mksetcd.bat
echo SET CD=>setcd.bat
cd>>setcd.bat

echo F 100 L 200 20 >debug.scr
echo N setcd.bat >>debug.scr
echo L 100 >>debug.scr
echo M 109 L 200 107 >>debug.scr
echo W >>debug.scr
echo Q >>debug.scr

debug <debug.scr


I could use it like so:

C:\TEMP>\mksetcd.bat
C:\TEMP>setcd.bat
C:\TEMP>echo %CD%
C:\TEMP



Do you know of a better way?

 

Complete thread:

Back to the forum
Board view  Mix view
23246 Postings in 2191 Threads, 405 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum