Controlling the output of a script changing IP addresses for installed printers

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
anndre12
Posts: 1
Joined: 11 Apr 2019 09:17

Controlling the output of a script changing IP addresses for installed printers

#1 Post by anndre12 » 11 Apr 2019 09:30

Hi everyone,
this is my first post :)

I realized this simple script that changes the IP addresses associated to a printer installed on the user computer.
It reads old and new printer IP addresses from an external txt file and change it accordingly

@echo off
echo ****************************************************************
echo *** Printers are being updated to the new IP, please wait ...
for /F "tokens=1,2 delims=," %%g in (Printers_CMO-FMO.txt) do wmic path win32_tcpipprinterport where "hostaddress = '%%g'" set hostaddress= "'%%h'" >nul
echo ***
echo *** Update completed!
echo ****************************************************************
pause

the format of the txt file that feed it:
10.248.16.27,10.19.60.7
xx
xxx
x
x
x


The script it's working! all good!
Only thing I'd like to show a message in the end that says something like

Success!
5 printers were successfully updated
10.248.16.27 -> 10.248.17.XX
10.248.16.28 -> 10.248.17.XX
10.248.16.29 -> 10.248.17XX
10.248.16.30 -> 10.248.17.XX
10.248.16.21 -> 10.248.17.XX


Actually I am using the >nul parameter to stop all messages from being shown to user

Can anybody suggest a way to achieve this?
Thanks!

Post Reply