@ECHO OFF
chcp 65001
setlocal EnableDelayedExpansion
color 3e
title tsc打印机安装
PUSHD %~DP0 & cd /d "%~dp0"
%1 %2
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :runas","","runas",1)(window.close)&goto :eof
:runas
::填写自己的脚本set desk =""
For /f "tokens=3,*" %%i in ('reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v "desktop"') do (set desk=%%i)
echo 请输入共享打印机名称(自带检查重复打印机有重复打印机自动先删除再安装,带空格的名称请填写“打印名称”)
set /P a=""
echo 请输入打印机的(USB001 USB001代表usb1号端口)
set /p b=""
::lpt1
rundll32 printui.dll,PrintUIEntry /dl /n %a% /q
echo %ERRORLEVEL%
rundll32 printui.dll,PrintUIEntry /if /Z /b %a% /f %desk%\790K\EBSD048M.inf /r "%b%" /m "EPSON LQ-790K ESC/P2"
echo %ERRORLEVEL%
for /f "delims=: tokens=2" %%i in ('ipconfig ^| find "IPv4" 2^>nul') do (
set ipaddr=%%i
set ipaddr=!ipaddr: =!
@echo !ipaddr!/%a%rd /s/q %userprofile%\Desktop\790K
echo %ERRORLEVEL%
del /q %userprofile%\Desktop\790K.bat
echo %ERRORLEVEL%
echo 执行完毕,任意键退出
pause >nul
del /f /q %desk%\790K.exe
exit
)
删除指定本地打印机脚本自动销毁程下:
@ECHO OFF
chcp 65001
setlocal EnableDelayedExpansion
color 3e
title tsc打印机安装
PUSHD %~DP0 & cd /d "%~dp0"
%1 %2
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :runas","","runas",1)(window.close)&goto :eof
:runas
::填写自己的脚本set desk =""
For /f "tokens=3,*" %%i in ('reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v "desktop"') do (set desk=%%i)
echo 请输需要删除的打印机名称
set /P a=::lpt1
rundll32 printui.dll,PrintUIEntry /dl /n %a% /q
echo %ERRORLEVEL%
for /f "delims=: tokens=2" %%i in ('ipconfig ^| find "IPv4" 2^>nul') do (
set ipaddr=%%i
set ipaddr=!ipaddr: =!
@echo !ipaddr!/%a%rd /s/q %userprofile%\Desktop\deldel删除指定打印机
echo %ERRORLEVEL%
del /q %userprofile%\Desktop\del.cmd
echo %ERRORLEVEL%
echo 执行完毕,任意键退出
pause >nul
del /f /q %desk%\del删除指定打印机.exe
exit)