系统版本:Windows 10企业版 64位(10.0 ,版本17134)- 中文(简体)

话不多说,直接上脚本:

REM 提升管理员权限
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else (
goto gotAdmin
)
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
cd /D "%~dp0" rem auto install
@echo off
chcp 65001 >nul
title 柯美C226打印机自动安装程序
color 0a :printer
ping 192.168.1.100 -n 1 | findstr /i "TTL" >NUL 2>NUL && goto fileserver
echo Cannot connect to the printer ...
goto end :fileserver
echo Detected the printer is online ...
ping 192.168.1.200 -n 1 | findstr /i "TTL" >NUL 2>NUL && goto driver
echo Cannot find any drivers of the printer ...
goto end :driver
rem 文件服务器共享目录,存放打印机驱动文件
net use \\192.168.1.200\fileserver /delete >nul
net use \\192.168.1.200\fileserver password /user:username >nul
if errorlevel 0 goto start
echo Connect to the fileserver failed ...
goto end :start
echo Driver found ... rundll32 printui.dll,PrintUIEntry /dl /n "KONICA MINOLTA C266SeriesPS" /q echo 正在准备安装打印机,请耐心等待 ... rem add port
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v StatusUpdateInterval /t REG_DWORD /d 0x0000000a /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v StatusUpdateEnabled /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Protocol /t REG_DWORD /d 0x00000002 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Version /t REG_DWORD /d 0x00000002 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v HostName /t REG_SZ /d "192.168.1.100" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v HWAddress /t REG_SZ /d "" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v IPAddress /t REG_SZ /d "" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v PortNumber /t REG_DWORD /d 0x00000203 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Community" /t REG_SZ /d "public" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Enabled" /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Index" /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v PortMonMibPortIndex /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Queue /t REG_SZ /d "print" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "Double Spool" /t REG_DWORD /d 0x00000000 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v StatusUpdateInterval /t REG_DWORD /d 0x0000000a /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v StatusUpdateEnabled /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Protocol /t REG_DWORD /d 0x00000002 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Version /t REG_DWORD /d 0x00000002 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v HostName /t REG_SZ /d "192.168.1.100" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v HWAddress /t REG_SZ /d "" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v IPAddress /t REG_SZ /d "" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v PortNumber /t REG_DWORD /d 0x00000203 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Community" /t REG_SZ /d "public" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Enabled" /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "SNMP Index" /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v PortMonMibPortIndex /t REG_DWORD /d 0x00000001 /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v Queue /t REG_SZ /d "print" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.100" /v "Double Spool" /t REG_DWORD /d 0x00000000 /f >nul @ping 127.0.0.1 -n 2 >nul rem restart printer service
sc stop spooler && sc start spooler @echo off
for /f "skip=3 tokens=4" %%i in ('sc query spooler') do set "zt=%%i" && goto :next
:next
if /i "%zt%"=="RUNNING" (
echo.
echo.
echo 打印机服务运行正常,打印机安装中 。。。
) else (
echo 打印机服务处于停止状态。
goto :end
) rem 安装打印机 rundll32 printui.dll,PrintUIEntry /if /b "KONICA MINOLTA C266SeriesPS" /f "\\fileserver\software\打印机驱动\柯美226_Windows\Win_x64\KOAXLA__.INF" /r "IP_192.168.1.100" /m "KONICA MINOLTA C266SeriesPS" /z
if not errorlevel 0 goto :end @ping 127.0.0.1 -n 6 >nul
echo.
echo 打印机已安装成功!!!
echo. rem public setting
reg add "HKEY_CURRENT_USER\Software\KONICA MINOLTA\KONICA MINOLTA C266SeriesPS\KONICA MINOLTA C266SeriesPS\Authentication" /v AuthType /t REG_DWORD /d 0x00000003 /f >nul
reg add "HKEY_CURRENT_USER\Software\KONICA MINOLTA\KONICA MINOLTA C266SeriesPS\KONICA MINOLTA C266SeriesPS\Authentication" /v UserType /t REG_DWORD /d 0x00000000 /f >nul
reg add "HKEY_CURRENT_USER\Software\KONICA MINOLTA\KONICA MINOLTA C266SeriesPS\KONICA MINOLTA C266SeriesPS\Authentication" /v UserName /t REG_SZ /d "" /f >nul
reg add "HKEY_CURRENT_USER\Software\KONICA MINOLTA\KONICA MINOLTA C266SeriesPS\KONICA MINOLTA C266SeriesPS\Authentication" /v UserPass /t REG_BINARY /d "" /f >nul rem 将这个打印机设置为默认打印机 rundll32 printui.dll,PrintUIEntry /y /n "KONICA MINOLTA C266SeriesPS"
:end
echo.
echo.
echo Press any key to quit.
pause >nul
exit

win10x64 批处理自动安装打印机的更多相关文章

  1. autoit3 脚本自动安装实例

    软件自动安装的相关实例!贴出来用于参考,并部分相关语法与示例 #RequireAdmin If DriveMapGet("T:")=="" Then Drive ...

  2. win10系统下安装打印机驱动

    以前安装过一次打印机的驱动,当时是从网上下载的,今天按照以前的方法安装打印机驱动,发现并不能使用,而且并不知道驱动还能自动安装. 首先在系统图标下选择设置-设备和打印机-添加打印机-搜索打印机,如果没 ...

  3. C# 将DLL制作CAB包并在浏览器下载,自动安装。(Activex)(包括ie打开cab包一直弹出用户账户控制,确定之后无反应的解决办法。)

    制作Activex程序网上有很多方法我就不说了,我的业务主要做的就是将DLL打包成CAB供浏览器下载. 下面制作证书,以及制作cab包需要用到一些工具.我将工具包上传到自己的博客园里了,以供大家下载. ...

  4. 下载更新文件后,调用安装器自动安装apk文件

    在更新操作时,下载新apk之后,往往需要自动安装新apk,用以下代码即可安装下载在本地的apk文件(apkFile) Intent intent = new Intent(); intent.setA ...

  5. mysql 自动备份和nginx自动安装脚本

    一.自动备份Mysql脚本: 如下脚本为mysql自动备份脚本,仅供参考,可以根据实际情况修改. #!/bin/sh #auto backup mysql #wugk #Define PATH定义变量 ...

  6. 转来的emacs配置文件,自动安装插件

    网上转来的emacs配置文件,便于自动安装插件,收藏起来 http://www.gogae.org/post-7/ EMACS是一个伪装成代码编辑器的操作系统. EMACS是一个非常强大的代码编辑器, ...

  7. linux系统PXE+Kickstart自动安装系统

    一.PXEPXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服 ...

  8. 实用脚本----Linux下Jdk和Tomcat自动安装shell脚本总结

    系统环境为:ubuntu 14.04 一.JDK 自动安装脚本 jdk自动安装bash shell脚本,截止今天(2014/10/15)亲测可用: sudo su #切换到root权限 mkdir / ...

  9. eclipse 手动/自动安装插件

    只要你的Eclipse的压缩包,一般为xxx.zip,其内部包含了对应的features和plugins文件夹,(不管是否还有content.jar和artifacts.jar)则都可以: 要么手动解 ...

随机推荐

  1. golang的cms

    golang的cms 说说cms cms(内容管理系统)是建站利器.它的本质是为了快速建站.cms本质是一个后台服务站,使用这个后台,能很快搭建一个前台web站.在PHP的世界里面,CMS框架简直不要 ...

  2. OAuth2实现单点登录SSO

    1.  前言 技术这东西吧,看别人写的好像很简单似的,到自己去写的时候就各种问题,“一看就会,一做就错”.网上关于实现SSO的文章一大堆,但是当你真的照着写的时候就会发现根本不是那么回事儿,简直让人抓 ...

  3. libevent和libcurl实现http和https服务器 cJSON使用

    前言 libevent和libcurl都是功能强大的开源库:libevent主要实现服务器,包含了select.epoll等高并发的实现:libcurl实现了curl命令的API封装,主要作为客户端. ...

  4. js数组遍历(for in ,for of ,map,foreach,filter)的区别

    一.for in 和for of 的区别 1.for in 遍历数组时,索引实际上是字符串类型的数字,不能进行运算,我们来输出一下: let arr = [1,3,5,4] for (let inde ...

  5. 网络学习笔记(二):TCP可靠传输原理

      TCP数据段作为IP数据报的数据部分来传输的,IP层提供尽最大努力服务,却不保证数据可靠传输.TCP想要提供可靠传输,需要采取一定的措施来让不可靠的传输信道提供可靠传输服务.比如:出现差错时,让发 ...

  6. 浅析HttpSession

    苏格拉底曰:我唯一知道的,就是自己一无所知 源头 最近在翻阅Springboot Security板块中的会话管理器过滤器SessionManagementFilter源码的时候,发现其会对单用户的多 ...

  7. fuzzing学习

    1.简介 1.1 fuzzing 模糊测试(fuzzing)是一种通过向程序提供非预期的输入并监控输出中的异常来发现软件中的故障的方法. 用于模糊测试的模糊测试器(fuzzer)可以按照以下3种方式进 ...

  8. C# 数组Array

    数组是对相同类型的一组数据的封装.数组定义的时候,要说明是对哪一种类型的封装,并且要指定长度. using System; using System.Collections.Generic; usin ...

  9. php禁用函数设置及查看方法详解

    这篇文章主要介绍了php禁用函数设置及查看方法,结合实例形式分析了php禁用函数的方法及使用php探针查看禁用函数信息的相关实现技巧,需要的朋友可以参考下 本文实例讲述了php禁用函数设置及查看方法. ...

  10. vue v-for动画bug

    因为是v-for 循环 出来的,:key = "index" 会出现问题,所以,需要把:key="XXX"换成其他属性就好了. 链接参考: https://se ...