我正在尝试通过批处理文件将打印机端口和打印机添加到本地计算机。 首先,我需要导航到C:\ Windows \ System32 \ Printing_Admin_Scripts \ en-US文件夹,然后执行以下命令
Cscript Prnport.vbs -a -r IP_xx.xx.xx.xx -h xx.xx.xx.xx
然后通过这些调用添加打印机驱动程序和打印机
rundll32 printui.dll,PrintUIEntry /ia /m "HP Universal Printing PCl 6" /h "x64" /v "Type 3" /f %windir%\inf\ntprint.inf /u
rundll32 printui.dll,PrintUIEntry /if /b "XXXXXX (HP LaserJet P4515)" /f "%windir%\inf\ntprint.inf" /r "IP_xx.xx.xx.xx" /m "HP Universal Printing PCl 6"
如何在批处理文件中完成?提前谢谢!
OP找到的解决方案以方便的形式复制到问题中
pushd "%windir%\System32\Printing_Admin_Scripts\en-US\"
Cscript Prnport.vbs -a -r IP_xx.xx.xx.xx -h xx.xx.xx.xx
rundll32 printui.dll,PrintUIEntry /ia /m "HP Universal Printing PCl 6" /h "x64" /v "Type 3" /f %windir%\inf\ntprint.inf /u
rundll32 printui.dll,PrintUIEntry /if /b "NPI8199E8 (HP LaserJet P4515)" /f "%windir%\inf\ntprint.inf" /r "IP_xx.xx.xx.xx" /m "HP Universal Printing PCl 6"