码迷,mamicode.com
首页 > 其他好文 > 详细

打印机连接向导

时间:2015-09-04 12:34:17      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

打印机连接向导,可自动识别是否是简体中文系统,然后选择提示语音。

首先使用当前用户进行连接,如果不是内网用户则连接无法建立,那么就会使用打印机操作员帐户进行连接。

 

@echo off
ver |findstr 版本
if %errorlevel%==0 (GOTO CNStart) else GOTO ENStart

: CNStart
cls
echo 打印机添加向导
echo.
echo 正在准备打印机列表,请稍等 ...
ping -n 3 127.0.0.1 >nul
cls
echo.
echo ==包装部 ============================
echo     [ 1 ] hp laser jet 1320 在 liaomingfang 上
echo     [ 2 ] hp laser jet 1320 在 limei 上
echo.
echo ==办公楼打印服务器 ==================
echo     [ 4 ] hp laser jet 2420 在 lntfbdc01 上
echo     [ 5 ] hp laser jet 2420 (2) 在 lntfbdc01 上
echo     [ 6 ] sharp ar316L [ A3打印机 ] 在 lntfbdc01 上
echo     [ 7 ] epson lq 1900 [ 针式打印机 ] 在 lntfbdc01 上
echo     [ 8 ] epson lq 1600 [ 针式打印机 ] 在 lntfbdc01 上
echo.
echo ==人事部 ============================
echo     [ 9 ] hp laser jet 1010 在 liaowen 上
echo.
echo ==生产部 ============================
echo     [ 11 ] hp laser jet 1320 在 tangping 上
echo.
echo ==财务部 ============================
echo     [ 13 ] hp laser jet 1020 在 yefengling 上
echo     [ 14 ] epson lq 680 [ 针式打印机 ] 在 huangmei 上
echo.
echo ==报关部 ============================
echo     [ 15 ] epson lq 680 [ 针式打印机 ] 在 wanglixia 上
echo.
set /p number=输入您需要连接的打印机[ 序号 ]然后回车:
FOR %%f in (1,2,5,6,7,8,9,11,13,14,15) do if %number% == %%f goto CASE%%f
       echo.
       echo 输入错误,向导即将退出 ...
       GOTO END

       : CASE1
  set IP=ln-shp-liaomf
  set Printer=hpLaserJ
        GOTO CNN

       : CASE2
  set IP=ln-shp-lim
  set Printer=hpLaserJ
        GOTO CNN

       : CASE4
  set IP=lntfbdc01
  set Printer=HPLaserJ2420
        GOTO CNN

       : CASE5
  set IP=lntfbdc01
  set Printer=HPLaserJ2420_2
        GOTO CNN

       : CASE6
  set IP=lntfbdc01
  set Printer=SHARPAR-316L
        GOTO CNN

       : CASE7
  set IP=lntfbdc01
  set Printer=EPSONLQ-1900
        GOTO CNN

       : CASE8
  set IP=lntfbdc01
  set Printer=EPSONLQ-1600
        GOTO CNN

       : CASE9
  set IP=ln-hr-liaowen
  set Printer=Hp Laser Jet 1010
        GOTO CNN
 
       : CASE11
  set IP=ln-prd-tangping
  set Printer=hpLaserJ
        GOTO CNN
 
       : CASE13
  set IP=ln-acc-yefl
  set Printer=HPLaserJ1020
        GOTO CNN
 
       : CASE14
  set IP=ln-acc-huangm
  set Printer=LQ680K
        GOTO CNN

       : CASE15
  set IP=ln-cus-wanglix
  set Printer=EPSONLQ-
        GOTO CNN

       : CNN
  echo.
  echo 您是外网用户,请按任意键继续连接打印机 . . .
  net use \\%IP% >nul 2>nul
  if %errorlevel% == 0 GOTO CNNOK
  net use \\%IP% "p-123456" /user:"ln-tf\lnp"
       : CNNOK
  cls
  echo.
  echo.
  echo 您选择了 [ %number% ] 号打印机,正在连接 ...
  rundll32 printui.dll,PrintUIEntry /in /n "\\%IP%\%Printer%"
  echo.
  echo.
  echo 打印机 \\%IP%\%Printer% 已连接,请自行设置为默认打印机.
  GOTO End
: ENStart
cls
echo Long Nan Topform Printer Connection Guide
echo.
echo Preparing Printers List, Plase wait  ...
ping -n 3 127.0.0.1 >nul
cls
echo.
echo ==Shipping Dept. ============================
echo     [ 1 ] hp laser jet 1320 At liaomingfang
echo     [ 2 ] hp laser jet 1320 At limei
echo.
echo ==Office Print Server ==================
echo     [ 4 ] hp laser jet 2420 At lntfbdc01
echo     [ 5 ] hp laser jet 2420 (2) At lntfbdc01
echo     [ 6 ] sharp ar316L [ A3 Printer ] At lntfbdc01
echo     [ 7 ] epson lq 1900 [ Stylus Printer ] At lntfbdc01
echo     [ 8 ] epson lq 1600 [ Stylus Printer ] At lntfbdc01
echo.
echo ==Human Resources Dept. ============================
echo     [ 9 ] hp laser jet 1010 At liaowen
echo.
echo ==Production Control Dept. ============================
echo     [ 11 ] hp laser jet 1320 At tangping
echo.
echo ==Account Dept. ============================
echo     [ 13 ] hp laser jet 1020 At yefengling
echo     [ 14 ] epson lq 680 [ Stylus Printer ] At huangmei
echo.
echo ==Customs Dept. ============================
echo     [ 15 ] epson lq 680 [ Stylus Printer ] At wanglixia
echo.
set /p number=Input prefix number of printer you want connect, then press enter:
FOR %%f in (1,2,5,6,7,8,9,11,13,14,15) do if %number% == %%f goto CASE%%f
       echo.
       echo Input error, guide exiting ...
       GOTO END

       : CASE1
  set IP=ln-shp-liaomf
  set Printer=hpLaserJ
        GOTO CNN

       : CASE2
  set IP=ln-shp-lim
  set Printer=hpLaserJ
        GOTO CNN

       : CASE4
  set IP=lntfbdc01
  set Printer=HPLaserJ2420
        GOTO CNN

       : CASE5
  set IP=lntfbdc01
  set Printer=HPLaserJ2420_2
        GOTO CNN

       : CASE6
  set IP=lntfbdc01
  set Printer=SHARPAR-316L
        GOTO CNN

       : CASE7
  set IP=lntfbdc01
  set Printer=EPSONLQ-1900
        GOTO CNN

       : CASE8
  set IP=lntfbdc01
  set Printer=EPSONLQ-1600
        GOTO CNN

       : CASE9
  set IP=ln-hr-liaowen
  set Printer=Hp Laser Jet 1010
        GOTO CNN
 
       : CASE11
  set IP=ln-prd-tangping
  set Printer=hpLaserJ
        GOTO CNN
 
       : CASE13
  set IP=ln-acc-yefl
  set Printer=HPLaserJ1020
        GOTO CNN
 
       : CASE14
  set IP=ln-acc-huangm
  set Printer=LQ680K
        GOTO CNN

       : CASE15
  set IP=ln-cus-wanglix
  set Printer=EPSONLQ-
        GOTO CNN

       : CNN
  echo.
  echo You are not intranet user,please press any key to continue . . .
  net use \\%IP% >nul 2>nul
  if %errorlevel% == 0 GOTO CNNOK
  net use \\%IP% "p-123456" /user:"ln-tf\lnp"
       : CNNOK
  cls
  echo.
  echo.
  echo You select [ %number% ] printer,connectting ...
  rundll32 printui.dll,PrintUIEntry /in /n "\\%IP%\%Printer%"
  echo.
  echo.
  echo Printer %Printer% has connected,Set as default printer by yourself.

 

 


      : END
  ping -n 4 127.0.0.1 >nul
  del %0
  exit

打印机连接向导

标签:

原文地址:http://www.cnblogs.com/lbnnbs/p/4781454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!