troubleshooting Question

# Project for humanity, have 1800 text files to search for numbers, do some math, print results to text file

Windows BatchPowershell* commandline
1800 scripts to search like below, that I have created a for humanity, so you can see the need, to be able to do this in bulk. I provided some code code.

SCRIPT
The world (SILENCE TAG="500") as we have created it (SILENCE TAG="500") is a process (SILENCE TAG"250") of our thinking (SILENCE MSEC="1000") It cannot be changed (SILENCE TAG="500") without changing our thinking (SILENCE TAG="1000") ~ Albert Einstein

I need a batch file that can go though all of the files in a folder, search text files for numbers inside these tags: (SILENCE TAG"500") then divided them by 2, and store the results into a variable like sum1. Copy the variable into a text file. Search's for the next number, divides it by 2, , and stores the results into a variable like sum2, now adds sum1+sum2 together, then copies the variable into a text file. It does this until it finds 1000. Then the saved variable is added to the 1000 .

PRINT TO DOC = PTD
The world (500/2=250) 250 PTD 250 remains
as we have created it (500/2=250) 250+250 remains .500 PTD 250 remains
is a process (250/2=125) 125+250 remains .375 PTD 125 remains
of our thinking (1000) 1000+125 remains 1.125 PTD 0 remains
It cannot be changed (500 / 2 = 250) 0 remains .250 PTD 250 remains
without changing our thinking .250 remains .250 PTD
1000+250 remains 1.250 PTD
END OF DOC

OUTPUT TO TEXT DOC
1st L-01-TV-01-Clip-01-silence
2nd .250
3rd .500
4th .375
6th .250
END OF DOC

Here is what I can contribute
```@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

DO UP TO 30 NUMBERS FOUND

for /L %%i in (1,1,30) do (
for /f "tokens=3 delims=. " %%A in (
)
:START

'findstr /rc:"At revision [0-9][0-9]*."'
do echo %%A

IF /I "%%i" EQU "1" GOTO first(

) ELSE (
IF /I "%%A" EQU "250" GOTO small(

) ELSE (
IF /I "%%A" EQU "500" GOTO medium (

) ELSE (
IF /I "%%A" EQU "500" GOTO large (

)

Copy short filename ADD -silence PTD

:first
set /a num1=%%A
set /a sum1=num1/2
set /a remains=sum1
set /a numout1=sum1
echo %numout1% >C:\Labels\L-01\filename-silence.txt
GOTO START

:small
set /a num2=%%A
set /a sum2=num2/2
set /a numout2=sum2+remains
echo %numout2% >C:\Labels\L-01\filename-silence.txt
GOTO START

:medium
set /a num3=%%A
set /a sum3=num3/2
set /a numout3=sum3+remains
echo %numout3% >C:\Labels\L-01\filename-silence.txt
GOTO START

:large
set /a sum4=%%A
set /a numout4=sum4+remains
GOTO START

ENDLOCAL
ENDLOCAL
)```

###### Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.