Understanding this catch command set start=%time: =0%
Posted: 21 Nov 2020 16:56
I made up a batch file in Windows 10 to backup some of my data on USB and it works fine using Xcopy. I wanted to know how long it ran as I didn't set and watch, looking around I found this command"
set t2=%time: =0%. So I used replacing t2 with something more meaningful like start and end. set start=%time: =0%
My question is I don't understand what the : =0 after the time does? I open a cmd screen and entered echo %time: =0% or echo %time: =2% or just echo %time% and get the same format of time. Thought I would see a differences. Even though my batch file works fine and I get the time displayed just fine, I wonder what this : =0 does? I guess it comes from being an old computer programmer- long time retired. Use to program Assembly, COBOL, Fortran and sometimes even machine language or binary.
set t2=%time: =0%. So I used replacing t2 with something more meaningful like start and end. set start=%time: =0%
My question is I don't understand what the : =0 after the time does? I open a cmd screen and entered echo %time: =0% or echo %time: =2% or just echo %time% and get the same format of time. Thought I would see a differences. Even though my batch file works fine and I get the time displayed just fine, I wonder what this : =0 does? I guess it comes from being an old computer programmer- long time retired. Use to program Assembly, COBOL, Fortran and sometimes even machine language or binary.