我正在使用这个脚本:
@echo on
setlocal ENABLEDELAYEDEXPANSION
set vidx=0
for /F "tokens=*" %%A in (C:\Users\Diana\Desktop\names.txt) do (
SET /A vidx=!vidx! + 1
snmpwalk -v 2c -c root %%A .1.3.6.1.2.1.25.3.3.1.2 > C:\Users\Diana\Desktop\cpu.txt
snmpwalk -v 2c -c root %%A .1.3.6.1.2.1.25.5.1.1.2 > C:\Users\Diana\Desktop\ramvid.txt
snmpwalk -v 2c -c root %%A .1.3.6.1.2.1.25.2.2 > C:\Users\Diana\Desktop\ram.txt
)
FOR /F "tokens=4" %%B IN (C:\Users\Diana\Desktop\ram.txt) DO echo %%B >> C:\Users\Diana\Desktop\ramfiltruotas.txt
FOR /F "tokens=4" %%B IN (C:\Users\Diana\Desktop\cpu.txt) DO echo %%B >> C:\Users\Diana\Desktop\cpufiltruotas.txt
FOR /F "tokens=4" %%B IN (C:\Users\Diana\Desktop\ramvid.txt) DO echo %%B >> C:\Users\Diana\Desktop\ramvidfiltruotas.txt
for /F %%a in (C:\Users\Diana\Desktop\ramvidfiltruotas.txt) do set /a c+=%%a echo %c% >> C:\Users\Diana\Desktop\naujas.txt
我正在尝试计算 file 中数字的总和ramvidfiltruotas.txt
,但是当我启动脚本时,它显示了很多:
C:\Users\Diana>set /a c+=3472 echo 1>>C:\Users\Diana\Desktop\naujas.txt
Missing operator.
C:\Users\Diana>set /a c+=2616 echo 1>>C:\Users\Diana\Desktop\naujas.txt
Missing operator.
也许有人可以帮我在这里找到问题?
顺便说一句,这个脚本可以在其他计算机上运行。