BATCH script to save DATE to a variable (Users)
> 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:
- BATCH script to save DATE to a variable - tauro, 01.03.2025, 04:19 (Users)
- BATCH script to save DATE to a variable - Rugxulo, 01.03.2025, 08:14
- BATCH script to save DATE to a variable - ecm, 01.03.2025, 12:15
- BATCH script to save DATE to a variable - marcov, 01.03.2025, 12:45
- BATCH script to save DATE to a variable - tauro, 02.03.2025, 02:16
- BATCH script to save DATE to a variable - Rugxulo, 02.03.2025, 03:26
- BATCH script to save DATE to a variable - RayeR, 25.03.2025, 05:44
- BATCH script to save DATE to a variable - rr, 25.03.2025, 18:41
- BATCH script to save DATE to a variable - Rugxulo, 01.03.2025, 18:43
- BATCH script to save DATE to a variable - rosegondon, 02.03.2025, 17:10
- BATCH script to save DATE to a variable - Rugxulo, 01.03.2025, 08:14