Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using 'NET USE' command to redirect LPT1 output
Message
From
14/01/2001 17:25:09
 
 
To
14/01/2001 15:13:46
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00462995
Message ID:
00463591
Views:
12
>Hi Al,
>
>SET PRINTER TO NAME is a Fox, not OS, native command, right ?
>
>I have run NET /? and NET HELP USE from the DOS box, but have obtained mixed results when using the NET USE command. I think trouble has happened when LPT1 has been previously defined, but am not sure. Am still looking for more complete info.
>

You're going to run into interesting issues when attempting to associate a DOS device name for a device that actually exists on the local machine with a remote device; the exact device receiving the redirected output can be a real toss of the dice, especially if the physical device is shared to the network. I've seen some really bizarre results where a printer on LPT1: is shared to the net, and the local user then uses Novell's CAPTURE to redirect output to LPT1: to a Novell print queue.

I'd recommend avoiding assigning actual physical ports to remote devices; Win9x supports up to LPT8: by default, NT lets you define port names through a Control Panel applet, and Win2K allows creation of port names through the Printers/Add New Printer dialog. Unfortunately, Win9x/WinME doesn't let you share a printer attached to one physical port and then attach it as a network printer to a different port; I've gotten around this by sharing a printer to the network, adding it to another system as a network device and sharing that, and then mapping the other machine's share of my networked printer back to a different port on the original machine; it's a kludge, adds a lot of baggage to the print output - there are actually three layers of spooling involved - but if you have to do it, it does work.

The biggest problem with adding new port names is the assignment of the proper printer driver to the port; NT and 2K are not happy writing to a port that has no driver associated with it. The Wscript.Network AddNewPrinter method takes care of the nevcessary dialogs to associate/load drivers for remote printers that don't publish their drivers (you can set up a Windows printer to publish its driver for several OS versions when shared; both NT and Win2K will let you specify the OS driver models to publish for shared printers; most Win9x driver unstalls don't offer this useful service.)

>Thanks for your reply.
>
>Alex
>
>
>
>>>Hi,
>>>
>>>Does anybody have detailed information on the NET USE command. I need it to redirect printer output from LPT1: to a printer in the network in Win2000.
>>>
>>>TIA,
>>>
>>>Alex
>>
>>There is a native command,
SET PRINTER TO NAME \\<i>servername\sharedprintername
If you want to use NET USE, as with all command-line utilities NET /? in a DOS box will get you close, and NET HELP USE closer still.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform