0

I am having a batch syntax which prints DateTime. Here it is

echo mydateTime_%date:~-4,4%_%date:~-7,2%d_%date:~-10,2%m_%time:~0,2%hr-%time:~3,2%min-%time:~6,2%sec

I want it to return

mydateTime_2015_22d_04m_9hr-41min-06sec

But it is returning

mydateTime_2015_22d_04m_ 9hr-41min-06sec

A space between 04m_ 9hr. I dont understand why space is generating ?

Harshit
  • 4,929
  • 7
  • 36
  • 81

1 Answers1

3
set "dt=mydateTime_%date:~-4,4%_%date:~-7,2%d_%date:~-10,2%m_%time:~0,2%hr-%time:~3,2%min-%time:~6,2%sec"
echo %dt: =%

try this

check also this

Community
  • 1
  • 1
npocmaka
  • 51,748
  • 17
  • 123
  • 166