I used the following to create a folder with a date and timestamp
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a-%%b)
set mydir="%mydate%-%mytime%"
mkdir %mydir%
Instead of created a folder named 2020-5-19-11-30 AM, I get one folder named 2020-5-19 and another folder called AM.
Any idea? I just want to run a batch file that will create a date and time including am or pm for a folder.