Simple Batch File

Soldato
Joined
23 Nov 2004
Posts
3,794
All,

I have been set a task to output a specific REG key value to a text file. The Script/App needs to loop round and repeat for 140 different servers on our VPN. (Store.ini contains list of servers)

I have given up trying to do this in WSH or VBS as my boss ordered, so i am going to do it in a simple batch file. See my code below.

Code:
@echo off
REM Printer Find Script
REM Script connects to all devices in Store.ini and querys the registry for the default printer installed
for /f %%i in (Store.ini) do (
	ECHO Querying Default Printer on %%iWNT01
	ECHO ---------------------------------------------------------------------------------- >>Results.txt
	ECHO Printer Driver Information For %%iWNT01 >>Results.txt
	REG QUERY "\\%%iWNT01\HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\%%iprn01" /V "Printer Driver" >>Results.txt
	ECHO ---------------------------------------------------------------------------------- >>Results.txt
	Echo. >>Results.txt
	Echo. >>Results.txt
)
ECHO Finished Running Script.
PAUSE

Currently it reutns the below Results: (X's = Server name)


----------------------------------------------------------------------------------
Printer Driver Information For XXXXXXXX

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\XXXprn01
Printer Driver REG_SZ HP LaserJet 4 Plus

----------------------------------------------------------------------------------

I don't want it to display all the other cack, i just want it to output the HP LaserJet.... bit with the manual ECHO's i have specified.

Do i need to create a different batch file to rip all this crap out, or can i specify it using a flag for REG QUERY? I have googled to no avail. :(
 
It after about 5/6 seconds and brings up the below error

errorlr2.jpg


Thanks for your time on this, baking my noodle here...

Edit: Sorry for white canvas in background as well, only got MSPAINT.
 
Back
Top Bottom