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 Rugxulo Homepage, Usono, 01.03.2025, 08:14

> I wrote this script after reading some of Timo Salmi's FAQs. I appreciate the minimalist approach, but perhaps a simple debug script or assembly tool would be cleaner. (Or even using REXX or 4DOS.) > This saves the current date to the variable date_ so it can be used later. Many DOS shells already provide this. What particular environment(s) are you targeting? > But there's a few key things that I don't understand. > > I discovered that the name of the first script "current.bat" must coincide > with the term used with find.exe. > Otherwise the script doesn't work. Why is this so? The line starts with "Current", so when GO.BAT is run, it runs that. > I'm open to all your suggestions and corrections. I'm here to learn. I would suggest using a FOR command to shorten these two lines into one: > if exist current.bat del current.bat > if exist go.bat del go.bat for %%a in (current go) do if exist %%a.bat del %%a.bat

 

Complete thread:

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