Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408080
  • 博文数量: 87
  • 博客积分: 6015
  • 博客等级: 准将
  • 技术积分: 960
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-13 16:59
文章分类
文章存档

2015年(4)

2010年(16)

2009年(13)

2008年(12)

2007年(29)

2006年(13)

我的朋友

分类: WINDOWS

2009-12-24 21:37:14

Set WshNetwork = createobject("wscript.network")
On Error Resume Next
WshNetwork.RemovePrinterConnection "", true
WshNetwork.RemovePrinterConnection "", true
WshNetwork.AddwindowsPrinterConnection("")
'WshNetwork.AddwindowsPrinterConnection("")
WshNetwork.SetDefaultPrinter ""
'Wscript.Echo "已删除指定打印机 The specified printer has been deleted"
'Wscript.Echo "已添加指定打印机 The specified printer has been add"
'Wscript.Echo "请手动设置您的默认打印机 Please set your default printer."
'dim oShell
'set oshell = WScript.CreateObject("WScript.Shell")
'oshell.run ("control.exe   printers")
'Set oShell=NoThing
'WScript.quit
'删除PRINT04,05并添加新的打印机.
'提示用户设置默认打印机,默认设置为print09.
 
-------------------------------------------------------------------
On Error Resume Next
strComputer = "."
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshNETWORK = WScript.CreateObject("WScript.Network")
'删除旧的Printer Server打印机
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
    ("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
    if lcase(left(objPrinter.Name,1)) <> "" then
        objPrinter.Delete_
    End if
Next
'建立新的Printer Server Connection
'WshNetwork.AddwindowsPrinterConnection("")
'WshNetwork.AddwindowsPrinterConnection("")
'WshNetwork.AddwindowsPrinterConnection("")
On Error GoTo 0

Wscript.Echo "请手动设置您的默认打印机"
dim oShell
set oshell = WScript.CreateObject("WScript.Shell")
oshell.run ("control.exe   printers")
Set oShell=NoThing
WScript.quit
阅读(1689) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~