Hi. I am trying to learn about Windows batch files and I am looking for some more complete documentation. I have found coding examples for pulling substrings out of longer strings and saving them in environment variables. See below example which demonstrates the substring syntax to extract the year, day, and month from the date.
set my_year=%date:~0,4%
set my_day=%date:~8,2%
set my_month=%date:~5,2%
While this is useful I would like to read and learn more about this syntax but I can't seem to find anything that more fully describes (i.e. what else can is possible with this syntax).
Can anyone point me towards a book or Microsoft documentation that goes into more detail about this substring syntax?
Thanks,
Peter
set my_year=%date:~0,4%
set my_day=%date:~8,2%
set my_month=%date:~5,2%
While this is useful I would like to read and learn more about this syntax but I can't seem to find anything that more fully describes (i.e. what else can is possible with this syntax).
Can anyone point me towards a book or Microsoft documentation that goes into more detail about this substring syntax?
Thanks,
Peter
- Windows Build/Version
- Windows 11 Home, 24H2, OS Build 26100.3194
My Computer
System One
-
- OS
- Windows 11
- Computer type
- PC/Desktop
- Manufacturer/Model
- ASUS ROG STRIX Z790 E
- CPU
- i7-13700K 3.40 GHz
- Motherboard
- ASUS ROG STRIX Z790 E
- Memory
- 64 GB
- Graphics Card(s)
- GIGABYTE RTX 3070 Ti
- Sound Card
- n/a
- Monitor(s) Displays
- BenQ SW2700 inch & Dell P1917S