Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

BATCH script to save DATE to a variable (Users)

posted by tauro E-mail, 02.03.2025, 02:16

> The line starts with "Current", so when GO.BAT is run, it runs that.
Thank you!
That's so obvious, how didn't I notice it?

> I would suggest using a FOR command to shorten these two lines into one:
> for %%a in (current go) do if exist %%a.bat del %%a.bat
Thanks for this!

> Many DOS shells already provide this. What particular environment(s) are
> you targeting?
I mainly use DOS 7.1 and 6.22 with the standard shell. I use FreeDOS too but not for this.

There's a freeware diagnostics program, NSSI, that I run on different computers while testing them, that is hard coded to print an error message if the current date is past 2008.

So with my script I save the current date, set the date as 12-31-2008, run the program, and then set the correct date again.

> I appreciate the minimalist approach, but perhaps a simple debug script or assembly tool would be cleaner. (Or even using REXX or 4DOS.)
Using assembly is probably a better way to do this, I agree. But it's out of my capabilities (at least for now). So your code is nothing short of black magic for me.

I compiled it and it prints the date this way:
Sat Mar 01,2025

But it doesn't create the DATE_ variable.

Could you please tweak your code so that it saves its content to the variable DATE_ with the date in this format MM-DD-YYYY? That's the format I need to use in my script to set the current date with the DATE command.

Is it possible to create/set a variable (the same way the SET command does) with an assembly program? Could you please give an example of assembly code that sets this environmental variable FOO=BAR? Just to try to understand it better.

If you can recommend any reading material on assembly for beginners that'd be great.

 

Complete thread:

Back to the forum
Board view  Mix view
22477 Postings in 2087 Threads, 400 registered users, 116 users online (0 registered, 116 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum