How to Hide Specific Lines in a Batch File

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

How to Hide Specific Lines in a Batch File

#1 Post by wchristner » 04 Mar 2016 11:49

Hello All!

I am currently trying to write a batch file to install printers in our small office.
The problem I am running into is I want only specific lines visible to users.
below is what i have so far. Everything in Dark Blue I want the users to see everything else can be hidden.
I don't really want to use a .vbs script and Powershell is currently not an option for my office. any suggestions would be helpful
Thanks

:Menu
cls
[color=#FFFF00]@echo Choose a Paw Paw Printer to install

@echo 1) Install Black and White Ricoh Printer
@echo 2) Install Xerox Color Printer
@echo 3) Install All Printers
@echo 4) Exit
[/color]
@echo.
@echo After installing printers this file will self destruct!
@echo.

set /p op= Choose your Printer:


if {%op%}=={1} (goto :print1)
if {%op%}=={2} (goto :print2)
if {%op%}=={3} (goto :print3)
if {%op%}=={4} (goto :exit)
@echo.


:print1
[color=#0000FF]
@echo.
@echo *Kinexus*
@echo
@echo This will Install the Ricoh Black and White printer on your computer.
@echo Once you click OK, it will run. It may take a minute to install.
@echo During that time you will see no screen activity until it finishes.
@echo Installing Printer.... please wait
@echo.
@echo [/color]
cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.168.144.80 -h 192.168.144.80 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Ricoh Aficio MP 6000 PCL" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf"
rundll32 printui.dll,PrintUIEntry /if /b "BH Paw Paw Black and White" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf" /r "IP_192.168.144.80" /m "Ricoh Aficio MP 6000 PCL"

@echo.
@echo *Kinexus*
@ECHO Installation of the Ricoh Black and White printer has completed!
@echo If you have any problems, please contact IT.
@echo.

pause
goto Menu

:print2

@echo *Kinexus*
@echo.
@echo This will Install the Xerox Color printer on your computer.
@echo Once you click OK, it will run. It may take a minute to install.
@echo During that time you will see no screen activity until it finishes.
@echo Installing Printer.... please wait
@echo.


cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.168.144.75 -h 192.168.144.75 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Xerox Phaser 6180N PCL 6" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf"
rundll32 printui.dll,PrintUIEntry /if /b "Paw Paw Color" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf" /r "IP_192.168.144.75" /m "Xerox Phaser 6180N PCL 6"

@echo.
@echo *Kinexus*
@ECHO Installation of the Xerox Color printer has completed!
@echo If you have any problems, please contact IT.
@echo.

pause
goto Menu



:print3


@echo *Kinexus*
@echo.
@echo This will Install all Paw Paw printers on your computer.
@echo Once you click OK, it will run. It may take a minute to install.
@echo During that time you will see no screen activity until it finishes.
@echo Installing Printer.... please wait
@echo.

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.168.144.80 -h 192.168.144.80 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Ricoh Aficio MP 6000 PCL" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf"
rundll32 printui.dll,PrintUIEntry /if /b "BH Paw Paw Black and White" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf" /r "IP_192.168.144.80" /m "Ricoh Aficio MP 6000 PCL"

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.168.144.75 -h 192.168.144.75 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Xerox Phaser 6180N PCL 6" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf"
rundll32 printui.dll,PrintUIEntry /if /b "Paw Paw Color" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf" /r "IP_192.168.144.75" /m "Xerox Phaser 6180N PCL 6"

@echo.
@echo *Kinexus*
@ECHO Installation of both Xerox & Ricoh printes has completed!
@echo If you have any problems, please contact IT.
@echo.

pause
goto Menu

:exit
exit

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How to Hide Specific Lines in a Batch File

#2 Post by foxidrive » 04 Mar 2016 11:58

Can I ask what is seen at the moment? Only the information in the echo commands?

If you place a rem before every echo command you want to disable, then they will be invisible. This assumes you have @echo off as the first line.

rem @echo line here

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: How to Hide Specific Lines in a Batch File

#3 Post by wchristner » 04 Mar 2016 12:11

Thanks I will give it a shot and let you know how it works

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: How to Hide Specific Lines in a Batch File

#4 Post by wchristner » 04 Mar 2016 12:16

so far everything is shown.
as it runs I can see all the processes of adding printer,
and just about all the commands that make this script happen.
If I knew how I would show a screenshot on this fourm.

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: How to Hide Specific Lines in a Batch File

#5 Post by wchristner » 04 Mar 2016 12:19

using rem @echo on say line set /p op= Choose your Printer:
disables the choice and just installs the printers. not quite what i'm looking for.

Thanks in advance for any help

thefeduke
Posts: 211
Joined: 05 Apr 2015 13:06
Location: MA South Shore, USA

Re: How to Hide Specific Lines in a Batch File

#6 Post by thefeduke » 04 Mar 2016 12:45

foxidrive wrote:This assumes you have @echo off as the first line.

Let me put it this way, in case wchristner missed it. Try it with the above change.

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: How to Hide Specific Lines in a Batch File

#7 Post by wchristner » 04 Mar 2016 13:19

Wow I feel Silly you are correct sir. Thank you
it looks much better.

thanks again

Post Reply