如何使用VBS添加共享打印机
答案:1 悬赏:80 手机版
解决时间 2021-03-23 07:27
- 提问者网友:贪了杯
- 2021-03-22 14:39
如何使用VBS添加共享打印机
最佳答案
- 五星知识达人网友:长青诗
- 2021-03-22 16:03
Option Explicit
On Error Resume Next
Dim objNetwork, strUNCPrinter, bForce, bUpdateProfile
strUNCPrinter = "\\ip地址\共享打印机名"
bForce = "True"
bUpdateProfile = "False"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection strUNCPrinter, bForce, bUpdateProfile
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo "已经添加了打印机:" & strUNCPrinter
Wscript.Quit
On Error Resume Next
Dim objNetwork, strUNCPrinter, bForce, bUpdateProfile
strUNCPrinter = "\\ip地址\共享打印机名"
bForce = "True"
bUpdateProfile = "False"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection strUNCPrinter, bForce, bUpdateProfile
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo "已经添加了打印机:" & strUNCPrinter
Wscript.Quit
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯