Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey all,
I am currently working on a BATCH file that will install a specific printer (on a printserver) to a computer. The current script looks is this:...
______________________________
@Echo offREM this command file will add a network printer to a computer remotely
REM the parameters are:
REM 1 - the name of the computer to which the network printer is to be added
REM 2 - the UNC name of the printer to be addedREM for example, to add the printer called ThePrinter that is shared from the computer PrintServer
REM to the computer called TheClient:REM key this command in a Command Prompt window:
REM addglobalprinterremotely theclient printserver\theprinter
REM add the specified printer to the specified computer
@Echo On
rundll32 printui.dll,PrintUIEntry /ga /c\\beit032 /n\\printserver\153_ca_hp2015
@Echo off
REM stop the print spooler on the specified computer and wait until the sc command finishes
@Echo On
start /wait sc \\beit032 stop spooler
@Echo off
REM start the print spooler on the specified computer and wait until the sc command finishes
@Echo On
start /wait sc \\beit032 start spoolerpause
______________________________
What I am after acheiveing is to be prompted for the following information..
1: PC Name (where the Printer will be installed - in the script as "\\beit032")
2: The printer. (in the script as "\\printserver\153_ca_hp2015")I have tried a few methods but just cant get it to work.
Any help on this would be great.
Thanks in advance.
Martyn

Martyn,
your question is not clear to me.
I guess you want a mechanism to take user input and use the input strings in the batch command?
Then this would work:
set /p PCName=Enter PC name:
:Use %PCName% in the rest of the script to refer to the user entered string
:Similarly, you can get printer name from user.
: You can also enumerate available printers from the "net view \\servername" command.
: Ex:for /f "tokens=1,2 delims= " %A in ('net view \\servername') do if %B==Print Echo %A is a printer--
Holla.

![]() |
xcopy folder disappearing...
|
email input forms from Ou...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |