.bat文件进行网络打印 [英] network printing from a .bat file

查看:114
本文介绍了.bat文件进行网络打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有效:

在大多数现代计算机上,PRINT将无用,因为它需要一个打印机端口(例如LPT1或COM1等),而如今大多数打印机都连接到USB端口或通过TCP/IP连接.
在这种情况下,使用PRINT命令的/P开关可以更好地替代PRINT命令:

NOTEPAD/P what.reg

即使.REG文件根本不与记事本关联(默认情况下也不应该),该文件仍将打印.reg.

记事本会将其输出发送到Windows的默认打印机.

但是是否可以使用相同的方法将输出定向到不是默认打印机的nework打印机?

This Works:

On most modern computers, PRINT will be useless, because it needs a printer port like LPT1 or COM1 etc., whereas most printers nowadays are connected either to USB ports or over a TCP/IP connection.

In those cases, a better alternative to the PRINT command is Notepad with its /P switch:

NOTEPAD /P whatever.reg

will print whatever.reg, even if .REG files aren''t associated with Notepad at all (by default they aren''t, and they shouldn''t be).

Notepad will send its output to Windows'' default printer.

But is there a way to direct the output to a nework printer that is not the default printer, using the same method?

推荐答案

您可以更改默认打印机,然后改回来.

要获取打印机:
You could change the default printer, then change it back.

To get the printer:
cscript %windir%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -g



要设置它:



To set it:

cscript %windir%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -t -p "\Servername\printername"



不幸的是,第一个以以下形式返回它:默认打印机为PrinterName",因此您必须将其分开.

(并且在Windows的某些早期版本中,脚本位于%windir%\ system32 \中)



Unfortunately, the first returns it in the form: "The default printer is PrinterName" so you''ll have to separate it out.

(And on some earlier versions of windows the script is located in %windir%\system32\ )


这篇关于.bat文件进行网络打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆