2

Is there a way to map a local directory in Windows 10 as a network drive? I want to map C:\datastore as if it were \\datastore . Although there is plenty of information on mapping a network drive to a local drive I'm basically wanting it to go in the other direction.

For background I'm testing a piece of compiled software that is currently throwing an exception while trying to read data from a file. I have access to the source code and can see that it's trying to reference a file on a hard-coded network drive. I don't have access to the network drive from my computer, though I was able to retrieve the file through other means and add it to a local folder. I want to test the software as it written without modifying the source code to refer to the local drive or relative path.

I tried mklink /D \\datastore C:\datastore and received The specified path is invalid.

1 Answer 1

4

UNC uses the following format: \\servername\resource\pathname

For example, to access the file test.txt in the directory "examples" on the shared server "example", you would look like this: \\example\examples\test.txt

Knowing this, its clear that a UNC folder path to simply \\folder is not possible. It is, indeed, a perfectly valid server name, as it points to server "folder" - but not as a ressource (which can be folder, but also a printer or named pipe).

But you can set up file sharing on your machine, create a share from 'datastore' and use \\your-machine\datastore as a path. You could also rename your machine to match hard coded request names.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .