Multiple Variables Outputted in Table Format
Posted: 10 Mar 2009 16:02
I've got multiple variables that I'm pulling from multiple text files in multiple locations. What I'd like to do is to put the location and variables in a table so that it is easily read:
The problem with this is that the variables only take the value of the last iteration of the loop, so the values with show in a table but all the values are taken from the last lines in input.txt. How can I code this so that the values are written for each iteration?
Code: Select all
FOR /F %%a IN ('TYPE input.txt') DO (
for /f "tokens=2-4 delims=/ " %%b in ('TYPE E:\temp\%%a\cpu.txt') do (
set CPUPercent_Used=%%d
)
for /f "tokens=2-4 delims=/ " %%c in ('TYPE E:\temp\%%a\memory.txt') do (
set MEMPercent_Used=%%e
)
for /f "tokens=2-4 delims=/ " %%b in ('TYPE E:\temp\%%a\cspace.txt') do (
set CDISK=%%d%%%
)
for /f "tokens=2-4 delims=/ " %%b in ('TYPE E:\temp\%%a\dspace.txt') do (
set DDISK=%%d%%%
)
@echo %%a %CPUPercent_Used% %MEMPercent_Used% %CDISK% %DDISK%
)
The problem with this is that the variables only take the value of the last iteration of the loop, so the values with show in a table but all the values are taken from the last lines in input.txt. How can I code this so that the values are written for each iteration?