A Printer Share Name that contains spaces or that is longer than 31 characters may cause certain Windows API calls to fail

Applies to: Windows

Summary


A Printer Share Name must not contain spaces, and the name must not be longer than 31 characters. Failure to follow these requirements may cause certain Windows API calls to fail. 

More Information


For more information about these Printer Share Name guidelines, visit the following Microsoft webpage:

Windows XP supports long printer names. And, this support lets you create printer names that contain spaces and special characters. However, if you share a printer over a network, some clients cannot recognize or correctly handle the long names, and users may have problems when they try to print. Also, some programs cannot print to printers that have names that are longer than 31 characters.

For shared printers, the complete qualified name must be fewer than 31 characters, and this name must include the server name, as in the following example:
\\PRINTER2\PSCRIPT
  • If you share a printer with many different clients on a network, use 31 or fewer characters for printer names, and do not include spaces or special characters in these names.
  • If you share a printer with MS-DOS computers, do not use more than eight characters for the printer's share name. You can lengthen the name by adding a period that is followed by no more than three characters. But you cannot use spaces in the name. 

Starting with the Windows Vista operating system, and this includes later versions of the Windows operating systems, if you do not follow these naming requirements, some Windows API calls may fail.

Note For example, if the Windows API, OpenPrinter, is used to obtain the printer handle by using a share name that contains spaces, the use of this handle in later calls such as GetPrinterData and SetPrinterData may fail.