Author Topic: IWshNetwork.AddPrinterConnection Method  (Read 2985 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • User-Rate: +209/-0
IWshNetwork.AddPrinterConnection Method
« on: July 14, 2008, 08:35:58 PM »

The following code uses the AddPrinterConnection method to connect a network printer to LPT1.

JScript

Code: [Select]
var WshNetwork = WScript.CreateObject("WScript.Network");
WshNetwork.AddPrinterConnection ("LPT1", "\\\\Server\\Print1");

VBScript

Code: [Select]
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"

PowerBASIC

Code: [Select]
DIM pWshNet AS IWshNetwork
pWshNet = NEWCOM "WScript.Network"
pWshNet.AddPrinterConnection UCODE$("LPT1"), UCODE$("\\Server\Print1")