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 ?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.