0

我想动态更改打印机名称..我使用 VBSCRIPT 为 32 位执行此操作

如何为 Windows 7 执行此操作

Const strFolder = "C:\MEDALL_PRINT_SERVICE\"

 Dim oFSO

 Set oFSO = CreateObject("Scripting.FileSystemObject")

 If Not oFSO.FolderExists(strFolder) Then
 oFSO.CreateFolder strFolder
 End If

 strComputer = "."
 Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colPrinters =  objWMIService.ExecQuery _
("Select * from Win32_Printer Where DeviceID = 'PDFCreator'")

For Each objPrinter in colPrinters
objPrinter.RenamePrinter("MEDALL PRINT SERVICE")
Next

Set colPrinters = objWMIService.ExecQuery _
("Select * From Win32_Printer Where DeviceID = 'MEDALL PRINT SERVICE' ")

For Each objPrinter in colPrinters
objPrinter.ShareName = "MEDALL PRINT SERVICE"
objPrinter.Put_
Next

这个怎么做... ?

4

0 回答 0