3 Ways to Access Network Path Using Command Line in Windows 10

Access and map network location using Command Line in Windows 10Access and map network location using Command Line in Windows 10

You may often need to access a file or a folder that is placed on a different device using the Command Line Interface (CLI) on your Windows 10 device. It may be because you need to execute the package or for any other reason. However, the simple Change Directory (cd) command in the Command Prompt is not sufficient to navigate to a path over the network.

This article discusses various methods and techniques you can use to access or even map network paths onto your device using the command lines.

Traditional methods to map and access network paths in Windows 10

Normally, users would access a network path using either Run or directly from the File Explorer. We shall also be discussing this method so that you understand the differences when we try and access a network path through the CLI.

  1. To map a network drive using File Explorer, click on This PC in the left navigation bar, and then click Map a network drive from the top menu within the Explorer.
    exp map
  2. A Map network drive wizard will now popup. Select a vacant alphabet to assign to the new drive , enter its path in the field below, select your preference by checking the boxes below, and then click Finish.
    exp wizard
    Note that the IP address on the network path can be changed to the name of the device. Moreover, the path is not case-sensitive, therefore the capital and small should not matter.
  3. You will now be prompted to enter the credentials of the destination user account to access the path. Enter the correct credentials and click OK.

You can now check that the path should be added as an attached drive on your PC in the File Explorer.

exp mapped

You can also access the network path directly through the Explorer or Run by typing in the path and providing the correct credentials.

run and exp

This is a convenient way to map and access network drives using the Graphical User Interface (GUI). However, what if you need to access certain files using the CLI and then execute them directly from there? We have a solution for you down below.

How to access network path using command line in Windows 10

You might know how to move around within your own computer using the Command Prompt or Windows PowerShell. However, moving to a path over the network is a different story.

Access network path from Command Prompt using Pushd command

Changing directories within the Command Prompt can be done by using the cd command. However, this does not work when accessing a remote path, and you will get an error stating “CMD does not support UNC paths as current directories.”

UNC path

The Universal Naming Convention (UNC) path is any path consisting of double forward or backslashes followed by a computer name/ IP address. This is not supported by Command Prompt and does not understand the command.

You need to use the pushd command to access a network path from the Command Prompt. Use the command below to do so:

pushd NetworkPath

Replace NetworkPath with the path to the location you wish to access over the network, such as in the example below:

pushd \\itechticsserver\sharedfolder
cmd pushd

Tip: If the location folder has space in its name, enclose the entire NetworkPath in inverted-commas (“”).

As you may notice in the image above, entering the command changed the working directory to z. This letter has been automatically assigned to the path, which is now also mapped and can be seen as a drive using the File Explorer.

Another way to access a network path from Command Prompt is to manually map it using the File Explorer traditionally, and then use the cd command to change the directory using the new assigned drive letter, as in the image below:

cd z

Map network path from Command Prompt using Net Use command

Another quick way to access a network path from Command Prompt is to use the Net Use command to initially map the location. This method allows you to mount the network drive as well as set a custom letter for it.

Use the command below to map location over the network:

net use Letter: NetworkPath /PERSISTENT:YES

Replace Letter with a vacant drive letter for the path and replace NetworkPath with the path to the location you want to access. Here is an example of using this command:


Now that the location has been mapped, simply use the cd command to access it.

access drive

Access network path from PowerShell using cd command

Unlike the Command Prompt, Windows PowerShell understands the UNC path, hence is able to use the cd command to change its directory. This method is easier as it is like accessing a local location rather than something over the internet.

Use the command below in PowerShell to access a network path:

cd NetworkPath

Replace NetworkPath with the location you wish to access, as in the example below:

ps cd

Mind you, this approach does not map the location, but only lets you access it via Windows PowerShell.

Closing words

There are multiple ways to access a network path using just the CLI. However, it is up to you to decide which method to use.

If you are required to run certain scripts after accessing the network path, we recommend that you use PowerShell to do so. However, if you have to perform basic tasks such as executing a package and obtain results within the CLI, the Command Prompt Should be enough.

If you simply want to browse the location, the traditional File Explorer should be sufficient for that.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information