>>If quote encapsulation isn't working as I suggested, the shared printer name resolves the same way as an LFN; you can use the API call GetShortPathName once to find the valid short name and use it. Quote encapsulation works for me, though.
>
>Can you give me the following with the appropriate syntax:
>
>NET USE LPT1 \\MY LONG COMPUTER NAME\MYPRINTERNAME
From a Win32 system, try the folowiung VFP snippet:
DECLARE INTEGER GetShortPathName IN Win32API ;
STRING @cLongPath, ;
STRING @cShortPathBuff, ;
INTEGER nBuffSize
cpathToCOnvert = "\\MY LONG COMPUTER NAME\MYPRINTERNAME" +CHR(0)
cBuf= space(511)
nBufSize = 511
nShortSize = GetShortPathName(cPathToConvert,@cBuf,@nBufSize)
IF nShortSize > 0
? LEFT(cBuf,nShortSize)
ELSE
? 'Burp! Couldn't do it'
ENDIF
That will return a usable UNC in 8.3 file formats. Try using the short name on the NET USE command from the DOS systems.
Problems:
(1) If this is real DOS or Win3.x and uses a Pre Win95 release of DOS (like MSDOS 6.22 or earlier), it doesn't contain the LFN support at all, and the above may not work. Workaround: Install the DOS subsystem from Win95 or Win98 as DOS by making a Win9x boot disk and copying files from the the Windows\Command directory of Win9x to provide the necessary command line services.
(2) If you have very old NDIS drivers, they may not support LFNs properly - this is an easier fix; update the NDIS drivers.
(3) If it's DOS, your machine name can't exceed 12 characters and must adhere to DOS file naming conventions (NO SPACES, or multiple . in the name, etc.) - UNC support for non-standard machine names didn't originate pre-Win95, other than to use the DOS subsystem from Win9x, or redo the server's NetBIOS name, you're stuck on direct access to an difficult UNC from older DOS.
(4) If the printer name rather than the machine name is a problem, an easy workaround is available from NT. NT can have multiple shares of the same device. Define a share name for the printer that's legal in addition to the one giving your DOS boxes heartburn...
(56) If the host isn't NT, you can still work around it by sharing it to another WinNT or Win9x box, and then having THAT system share its printer connection with a legal UNC for DOS.
(6) Arrive next to the PC with a screwdriver, soldering iron and a supply of chips. This may frighten the machine into behaving rather than risking radical surgery.
(7) And when's the last time you attended mass and went to confession? If you aren't Catholic, my apologies for asking the wrong question - when did you last perform a ritual sacrifice of an end-user to TPTB?
(8) Rename the machine and share. And promise to never, ever use LFNs with real DOS ever again.