Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

save & restore environment (Developers)

posted by Rugxulo Homepage, Usono, 28.02.2026, 03:18

> awk -f mkenvset.awk >envset.bat
> call helper.bat
> awk -f mkenvdel.awk >envdel.bat
> call envdel.bat
> call envset.bat

>
> This would effectively restore the original environment without using a
> COMMAND /C sub-shell.
>
> What do you think? Is it a bad idea? Why?

4DOS and NT's CMD both have "SETLOCAL". So if you don't need any vars to persist, try that.

If you insist on this way (presumably to run on older shells), I'd suggest putting it in a single .BAT like "SAVEENV.BAT [on | off]". The AWK scripts are small enough to be in-place, but even an embedded AWK script (or ten) is easy to use.

 

Complete thread:

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