PC Review


Reply
Thread Tools Rate Thread

Batch file to add a network printer

 
 
=?Utf-8?B?TGVl?=
Guest
Posts: n/a
 
      20th Apr 2004
Hi
I want to create a batch file that, when it is run from a workstation, automatically connects to a network printer. If someone could let me know what the syntax for this would be I would really appreciate it. Thankyou

Regards
Lee
 
Reply With Quote
 
 
 
 
Carrie Garth
Guest
Posts: n/a
 
      20th Apr 2004
> "Lee" <(E-Mail Removed)>
> wrote in message news:A3918E70-C3C0-4931-96E0-(E-Mail Removed)...
> I want to create a batch file that, when it is run from a workstation,
> automatically connects to a network printer. If someone could let me know what the
> syntax for this would be I would really appreciate it. Thankyou.


You might be able to find a suitable script from the samples at the following site:

Microsoft TechNet Script Center - Printing
http://www.microsoft.com/technet/com...g/default.mspx

And if you do not, or need any help with batch files, you may want to try posting
in the following Microsoft Newsgroup:

microsoft.public.win2000.cmdprompt.admin

Your newsgroup message header seems to indicate that you are posting to the Microsoft
Public Newsgroups using the Microsoft Communities Web Page. If I am correct, if you
click the first link below it will open your browser to:

Microsoft Communities Newsgroups Web Interface:
microsoft.public.win2000.cmdprompt.admin
http://communities2.microsoft.com/co...&lang=en&cr=US

If you read newsgroups using a NNTP newsreader, such as Outlook Express, and
use the msnews.microsoft.com news server, here is a link:
news://msnews.microsoft.com/microsof...mdprompt.admin



 
Reply With Quote
 
David Candy
Guest
Posts: n/a
 
      20th Apr 2004
On Error Resume Next
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
strDriveHarasty = "Z:"
strDriveMorestaff = "Y:"

WshNetwork.MapNetworkDrive strDriveHarasty, "\\Server5\Share"
ReportErrors "Mapping Drive."
WshNetwork.MapNetworkDrive strDriveMorestaff, "\\Server5\Share"
ReportErrors "Mapping Drive."

WshNetwork.AddWindowsPrinterConnection "\\davidcan\HP Laser Jet 6L"
ReportErrors "Adding Printer."
WshNetwork.SetDefaultPrinter "\\h8\HP Laser Jet 6L"
ReportErrors "Setting Default Printer."
Sub ReportErrors(ErrText)
If err.number <> 0 then
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.LogEvent 1, ErrText & " Error code " & err.number & " (" & err.description & ")"
Err.clear
End If
End Sub



--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
"Lee" <(E-Mail Removed)> wrote in message news:A3918E70-C3C0-4931-96E0-(E-Mail Removed)...
> Hi,
> I want to create a batch file that, when it is run from a workstation, automatically connects to a network printer. If someone could let me know what the syntax for this would be I would really appreciate it. Thankyou.
>
> Regards,
> Lee

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add printer with batch file Jac Windows XP General 0 17th Jun 2005 07:19 PM
Installing network printer through batch file Eric Dreksler Windows XP Print / Fax 3 7th Nov 2004 05:36 AM
Batch command to print text file on network printer using notepad John Wirt Microsoft Windows 2000 Setup 1 12th Aug 2004 04:39 AM
is printer available from batch file jm Windows XP Print / Fax 0 6th May 2004 07:19 PM
How to Uncheck File and Printer sharing via registry or batch file? USP Windows XP Setup 0 16th Dec 2003 05:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:29 AM.