How to Install File & Printer Sharing From Commandline

Written by tammy clevenger
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Install File & Printer Sharing From Commandline
You can set File and Print Sharing from the command line. (Network connection image by Fantasista from

Microsoft Windows operating systems (all versions) ship with functionality to share files and printers over a network. Sharing files and printers though the Windows 7 or Vista interface is straightforward. By right-clicking on a file, selecting the "Share" option, and choosing users with whom to share the file, sharing may be enabled for any file or folder. For printers, the process is similar. Right-click on the printer to share in the Control Panel Printers interface, and select "Sharing." Check the checkbox to "Share the Printer" and click "OK." However, occasions may arise when file and printer sharing must be configured from the command line. Fortunately, Microsoft provides command-line functionality for the file and printer sharing components, as well.

Skill level:
Moderately Easy

Things you need

  • Computer running a Windows operating system
  • LAN (local area network)
  • Printer

Show MoreHide


    Install File Sharing from the Command Line

  1. 1

    Open Windows Explorer by right-clicking on "Start" and selecting "Explore."

  2. 2

    Create a folder that will be easily accessible from the command line. For example, create a new folder named Shared directly on the root of the C: drive. The path to the folder would be "C:\Shared."

  3. 3

    Drag all files that will be shared into the new "Shared" folder.

  4. 4

    Click the "Start" button and select "Run" in Windows XP, 2003 and 2000. Click the "Start" button in Vista and Windows 7 to show the "Search" input box.

  5. 5

    Type "cmd" and press the "Enter" key on the keyboard. The command prompt window will open.

  6. 6

    Type the following command, without quotes, at the command prompt (c: prompt):

    "net share Shared=c:\Shared"

  7. 7

    Press the "Enter" key. A new network share is created and named "Shared."

  8. 8

    Open "Network" in the Windows Start menu to view the "Shared" folder. If the folder is visible in the Network interface, the folder and files have been successfully shared.

    Install Printer Sharing from the Command Line

  1. 1

    Determine the name of the network printer and server that hosts the printer. For this example, "Server" will be the server, and "Printer" will be the printer.

  2. 2

    Click the Windows "Start" button, type "cmd" in the Search input box and press "Enter" in Windows 7 and Vista. In XP and other versions of Windows, click "Start" and then click "Run" from the Start menu. Type "cmd" into the "Run" input box and click the "Open" button. The command prompt window will launch.

  3. 3

    Type the following command, without quotes, at the C: prompt and press "Enter":

    "net use lpt1: \Server\Printer"

    LPT1 is the first printer port utilised in Windows. If a printer is already installed on "LPT1," enter "LPT2".

  4. 4

    Test the newly installed printer by printing a document to the shared printer.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.