I'm trying to set up scheduled tasks for all the machines in our network. So they don't all have the same start time I edit the XML file to use a random time. The changing the XML works fine, but as soon as I put a For loop around it to use servers.txt I get an error message: "+10 was unexpected at this time."
@echo off
for /F "tokens=*" %%i in (servers.txt) do (
set file=original.xml
set insertline=9
SET /a uur=(%RANDOM%*6/32768)+10
SET /a minuut=(%RANDOM%*50/32768)+10
set output=output.XLM
(for /f "tokens=1* delims=[]" %%a in ('find /n /v "##" ^< "%file%"') do (
if "%%~a"=="%insertline%" (
echo ^<StartBoundary^>2018-12-17T%uur%:%minuut%:43.9766025^<^/StartBoundary^>
REM ECHO.%%b
) ELSE (
echo.%%b
)
)) > %output%
SchTasks /Create /S \\%%i /RU username /RP password /XML output.XLM /TN task_name
)