10

While searching for a way to create a date-named directory in Windows, I came accross this question with that accepted answer.

There's a comment below the accepted answer:

To make it more easy: mkdir %date:/=%

So, %date% prints the current date, but what does :/= do?

Community
  • 1
  • 1
eckes
  • 64,417
  • 29
  • 168
  • 201

2 Answers2

14

It means substitute for the string between the : and the = with the string after the = and before the closing %

So it strips out any / from the variable %date% which is set by default to the current date.

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • Read your profile and wanted to reach out to you personally besides IT and computing. Have a story to share you might like. Can I contact you somehow? – lowtechsun Aug 03 '15 at 14:50
  • you can del it now. Thank you. You will hear from me in the next couple of hours. Thank you very much for getting back to me. – lowtechsun Aug 05 '15 at 10:35
9

The form of the command is

%variable:text=replace%

and it removes text and inserts replace in the same spot.

In your case the replace is empty so it just removes any / characters from the date string.

foxidrive
  • 40,353
  • 10
  • 53
  • 68