Raj Shivaram
asked on
Script is looping without an end
Need help with this script. I am trying to get the os, version and patches installed on a server. When i run the script the loop is not stopping and it seems to be running forever until i intervene and stop the script. Please help me in understanding where i am going wrong.
@echo off
setlocal
rem Define output file location
set outputfile=%computername%. csv
rem Overwrite output file and add header line
echo Caption,Version,Node,Descr iption,Typ e,HotFixID ,Installed By,Install edOn>>%out putfile%
rem Gather all data desired
for /f "skip=2 tokens=2 delims=," %%a in ('wmic os get caption /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%b in ('wmic os get version /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%c in ('wmic qfe get csname /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%d in ('wmic qfe get caption /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%e in ('wmic qfe get description /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%f in ('wmic qfe get hotfixid /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%g in ('wmic qfe get installedby /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%h in ('wmic qfe get installedon /format:csv') do (
rem Write merged results to output file
echo "%%~a","%%~b","%%~c","%%~d ","%%~e"," %%~f","%%~ g","%%~h"> >%outputfi le%
)
)
)
)
)
)
)
)
@echo off
setlocal
rem Define output file location
set outputfile=%computername%.
rem Overwrite output file and add header line
echo Caption,Version,Node,Descr
rem Gather all data desired
for /f "skip=2 tokens=2 delims=," %%a in ('wmic os get caption /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%b in ('wmic os get version /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%c in ('wmic qfe get csname /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%d in ('wmic qfe get caption /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%e in ('wmic qfe get description /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%f in ('wmic qfe get hotfixid /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%g in ('wmic qfe get installedby /format:csv') do (
for /f "skip=2 tokens=2 delims=," %%h in ('wmic qfe get installedon /format:csv') do (
rem Write merged results to output file
echo "%%~a","%%~b","%%~c","%%~d
)
)
)
)
)
)
)
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Welcome, glad that was helpful.
»bp
»bp
ASKER