AddWindowsPrinterConnection (WshNetwork オブジェクト)

Windows NT/2000:
object.AddWindowsPrinterConnection(path)

Windows 9x/Me:
object.AddWindowsPrinterConnection(path, drive, [port])

引数

object
WshNetwork の名前を指定します。
path
プリンタ接続へのパスを指定します。
drive
ドライブ名を指定します。(Windows 9x/Meのみ)
port
プリンタ接続のプリンタ ポートを指定します。(Windows 9x/Meのみ)


解説

Windows ベースのプリンタ接続をコンピュータ システムに追加します。


使用例
'Windows NT/2000の場合
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\Server1\Printer1"
WshNetwork.AddWindowsPrinterConnection PrinterPath

''Windows 9x/Meの場合
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\Server1\Printer1"
PrinterDriver = "Canon Printer Driver"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver


AddWindowsPrinterConnection (WshNetwork オブジェクト) に関連する項目

ComputerNameコンピュータ名を返します。
UserDomainユーザー ドメイン名を返します。
UserNameユーザー名を返します。
AddPrinterConnectionリモートの MS-DOS ベースのプリンタ接続をコンピュータ システムに追加します。
EnumNetworkDrivesネットワーク ドライブの現在の割り当てを返します。
EnumPrinterConnectionネットワーク プリンタの現在の割り当てを返します。
MapNetworkDrive共有ネットワーク ドライブをコンピュータ システムに追加します。
RemoveNetworkDriveコンピュータ システムの共有ネットワーク ドライブ接続を解除します。
RemovePrinterConnectionコンピュータ システムの共有ネットワーク プリンタ接続を解除します。
SetDefaultPrinter指定されたリモート プリンタを既定のプリンタとして設定します。




WSH講座



WSHリファレンス

組み込みオブジェクト




ファイル操作オブジェクト


Copyright (C) WSH@Workshop All rights reserved.