for /f "tokens=2 delims==" %%A in ('wmic path win32_localtime get dayofweek /format:value') do (
for /f %%B in (x) do (
del /q x > nul
The reason !day! is echoed into a file, then read again is because you can't perform operations with the number without removing some "invisible" characters from the string.
99 little bugs in the code,
99 little bugs.
Take one down, patch it around,
129 little bugs in the code.