博客统计信息

用户名:liao0804
文章数:83
评论数:147
访问量:40718
无忧币:403
博客积分:986
博客等级:4
注册日期:2009-09-23

Windows 7 的 NET PRINT 指令在哪里?
2009-09-23 16:08:22
版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。
 如果你习惯下指令来操作系统,那么您可以试试在 Windows 7 的 command line 底下输入 "net /?",你会发现下图:
NET
耶... 怎么 NET PRINT 的指令不见了?
是的,你没有看错,NET PRINT 指令在 Windows 7 已经不存在了。
为什么呢?根据中国 TechNet 团队特派员的了解,决定不在 Windows 7 继续提供 NET PRINT 指令有两个理由,一是指令的使用率,二是有其他的方式可以达到同样的目的。
在我们开始说明有哪些方式可以达到同样的效果前,先让我们来复习一下 NET PRINT 这个指令吧。
透过 NET PRINT 的指令说明(如下)我们可以知道,NET PRINT 是用来显示当前列印工作排序状态。您可以透过指令来指派列印工作的状态,例如暂停列印工作、恢复列印工作以及删除列印工作。
NET PRINT
\\computername\sharename
          [\\computername] job# [/HOLD | /RELEASE | /DELETE]
NET PRINT displays print jobs and shared queues.  For each queue, the display lists jobs, showing the size and status of each job, and the status of the queue.
  • computername is the name of the computer sharing the printer queue(s).
  • sharename is the name of the shared printer queue.
  • job# is the identification number assigned to a print job.  A computer with one or more printer queues assigns each print job a unique number.
  • /HOLD prevents a job in a queue from printing.  The job stays in the printer queue, and other jobs bypass it until it is released.
  • /RELEASE reactivates a job that is held.
  • /DELETE removes a job from a queue.
虽然 NET PRINT 已经不复存在,但是你在 %windir%\System32\Printing_Admin_Scripts\en-US 找到 prnjobs.vbs 来实现相同的功能。
prnjobs.vbs
 这里要注意的是,如果您想要在command line里下 prnjobs.vbs -? 指令的话,必须向下图这样下:cscript prnjobs.vbs -?
CScript 
底下列出 prnjobs 的指令说明:
Usage: prnjobs [-zmxl?] [-s server][-p printer][-j jobid][-u user name][-w password]
As you can see from the command above, there are several arguments that can be passed to the script:
  • -j is the job id
  • -l is used to list all jobs
  • -m used to resume the job
  • -p used to specify the printer name
  • -s used to specify the server name
  • -u specify the user name of a user (passing admin credentials for example)
  • -w specify the password
  • -x used to cancel a print job
  • -z used to pause a print job
  • -? display command usage / help
如果您想要利用 prnjobs.vbs 来进行打印机的管理,那么我也列出几个常用的指令与过去和 NET PRINT 指令的对照,方便您使用:
 
作用
NET PRINT 指令
PRNJOBS.VBS 指令
列印工作排序状态
NET PRINT <printer name>
cscript prnjobs.vbs –l –p <printer name>
暂停列印工作
NET PRINT <printer name> <job id> /hold
cscript prnjobs.vbs -p <printer name>  -j  <job id> -z
恢复列印工作
NET PRINT <printer name> <job id> /release
cscript prnjobs.vbs -p <printer name>  -j  <job id> -m
删除/取消列印工作
NET PRINT <printer name> <job id> /delete
cscript prnjobs.vbs -p <printer name>  -j  <job id> -x
 
上面的对照表示假设您使用的是本机打印机,如果您要管理远端的打印机,请记得加 -s 这个参数。
您也可以透过 PowerShell 脚本以及 WMI 脚本来执行这个指令。
祝大家使用愉快。 
 
参考资料:
分享至
更多
一键收藏,随时查看,分享好友!
0人
了这篇文章
类别:Windows 7技术圈()┆阅读()┆评论() ┆ 推送到技术圈返回首页

文章评论

 
2009-09-23 17:13:15
学习了 正好用的到

2009-09-24 13:59:51
谢谢 vivianvivi 同志的鼓励

2009-09-25 17:22:36
我还以为是因为我用的英文系统 我不认识找不到了呢。。

2009-09-25 17:57:58
Hi 漠北,谢谢你的留言,以后我们会更努力的服务各位。也请将您有兴趣像知道的知识点告诉我们。谢谢。

2009-09-26 13:56:29
虽然用的不多,但还是很用的.

2009-09-26 21:48:52
来顶一下,Jack 你也在51开博了。。

2009-10-15 13:54:42
Hi 万利兄,
希望咱能有机会碰碰。^_^

 

发表评论            

【技术门诊】专家解析:软考重点难点及应试技巧
昵  称:
登录  快速注册
验证码:

请点击后输入验证码博客过2级,无需填写验证码

内  容: