Text - String data type in DOS
When you want to use the time, you will get colon that you can't use in a file name. To overcome this problem, you can replace the colon with an underscore.
set theTime=%time% echo theTime
:: Replace : with _ echo %theTime::=_%
The slice operation syntax is:
- the ~ tilde indicates the slice function
- indexFirst indicates the position of the first letters (It can be negative)
- numberOfLetters indicates the number of letters (It can be negative)
set theTime=%time% echo %theTime%
- Extracting the substring from the third position with 2 letters length.
- Removing the last three characters (From the beginning to the end minus three characters)
- Removing the first three characters:
- Extracting the last three character