Page 1 of 1
using sortable date as parameter without typing the date
Posted: 22 May 2020 18:34
by Norma
I have a number of batch files that use the current date, in yyyymmdd format, as a parameter. Is there an alternative to having to key in the date a digit at a time when I run the batch file?
Re: using sortable date as parameter without typing the date
Posted: 24 May 2020 04:14
by aGerman
Code: Select all
@echo off &setlocal
for /f %%i in ('WMIC OS Get LocalDateTime /value') do for /f %%j in ("%%i") do set "%%j"
set "d=%LocalDateTime:~,8%"
:: echo %d%
:: pause
call "yourScript.bat" %d%
There are two lines commented out, where you can check if %d% contains the today's date string. The last line shows how to pass it to the first parameter of your script.
Steffen
Re: using sortable date as parameter without typing the date
Posted: 24 May 2020 07:17
by Norma
Thank you!