make a list of available printers in CMD

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bramsharon
Posts: 32
Joined: 07 Sep 2012 03:50

make a list of available printers in CMD

#1 Post by bramsharon » 07 Sep 2012 03:54

Hi there,

For my company i am building my first script. everything is done except 1 thing.

The system administrator needs this script to setup the computer for use after the imaging. also the printer needs to be set to default

there are a minimum of 5 printers for every image so i want to create an menu in the command prompt so the user can insert an letter like A,B,C,D,E,F to choose the printer he wants. i hope you get my point. i know there is a way to do that but i need the full command.. could someone help me out??

would be great ! thanks !

Bram

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: make a list of available printers in CMD

#2 Post by abc0502 » 07 Sep 2012 06:50

Try this

Code: Select all

@echo off

:printer
Setlocal EnableDelayedExpansion
cls
Echo =============================
Echo =   Printer Setup       =
Echo =============================
Echo.
Echo    Select Printer ( A,B,... etc):
Echo   -------------------------------- &Echo.
Echo    A^> Printer 1
Echo    B^> Printer 2
Echo    C^> Printer 3
Echo    D^> Printer 4
Echo    E^> Printer 5
Echo    F^> Printer 6
Echo.
Set "input="
Set /P "input= Printer: "
IF /i "!input!" == "A" ( goto printer1 )
IF /i "!input!" == "B" ( goto printer2 )
IF /i "!input!" == "C" ( goto printer2 )
IF /i "!input!" == "D" ( goto printer2 )
IF /i "!input!" == "E" ( goto printer2 )
IF /i "!input!" == "F" ( goto printer2 )

:printer1
::put commands to set printer 1 here
goto next

:printer2
::put commands to set printer 2 here
goto next

:printer3
::put commands to set printer 3 here
goto next

:printer4
::put commands to set printer 4 here
goto next

:printer5
::put commands to set printer 5 here
goto next

:printer6
::put commands to set printer 6 here
goto next

:next
:: Here put the rest of the codes

bramsharon
Posts: 32
Joined: 07 Sep 2012 03:50

Re: make a list of available printers in CMD

#3 Post by bramsharon » 10 Sep 2012 03:44

thanks, i will try this out!

bramsharon
Posts: 32
Joined: 07 Sep 2012 03:50

Re: make a list of available printers in CMD

#4 Post by bramsharon » 10 Sep 2012 03:48

after reading your script i determined that it is the same one i created. you need to fill in the names of that printer. my idea was that the script automatically shows you the added printers. so that if you execute it on an other pc with other printers, it will automatically show you that printers. i don't want to change the script for every pc with different printers. is this even possible? or did i read your script wrong?

Post Reply