53

What's the UNC path to a folder on my local computer, and how can I access it?

I have tried:

  1. Security for the folder – set to Everyone Full Control (for now!)
  2. Sharing permissions – set to Everyone Full Control (for now!)

I can see the folder in \\<computername>, but can't go in (<foldername> is not accessible.)

Error message:

You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions. The network location cannot be reached. For information about network troubleshooting, see Windows Help.

My computer is not connected to a network.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
xt_20
  • 1,406
  • 3
  • 13
  • 27

3 Answers3

91

If you're going to access your local computer (or any computer) using UNC, you'll need to setup a share. If you haven't already setup a share, you could use the default administrative shares. Example:

\\localhost\c$\my_dir

... accesses a folder called "my_dir" via UNC on your C: drive. By default all the hard drives on your machine are shared with hidden shares like c$, d$, etc.

William Leara
  • 10,595
  • 4
  • 36
  • 58
  • 1
    Thanks for your reply William. Does that only work if you are a local administrator? I get 'Windows cannot find '\\localhost\c$\SSRSFileShare'. Check the spelling and try again, or try searching for the item by clicking the Start button and then clicking Search'. I am a 'Debugger User'. (=power user?) – xt_20 May 10 '10 at 01:13
  • 3
    \\localhost and \\127.0.0.1 are exactly the same. I suspect that if \\localhost didn't work it was because the MS Loopback adapter wasn't installed. Either should work for you equally well. – William Leara May 11 '10 at 15:33
  • I need to get the UNC for the Q drive on my work computer. How would I go about doing this? – Doug Hauf Jan 31 '14 at 14:29
  • 1
    if you are trying to map to the root of a local drive using the GUI for map a network drive or the commandline `net use`, you'll have to essentially use @WilliamLeara's suggestion (`\\localhost\C$`). Another alternative is `mklink /j C:\self C:\ ` followed by `subst O: \\?\C:\self` if mapping to `O:`. For some reason using `\\?\C` or `\\.\C` with or without a terminal `$`, `\ `, `$\ `, or `:\ ` doesn't work, (Windows 10) nor does `subst o: \\?\c$` directly (w or w/o `$`, `\ `, `$\ `, `:\ `) – mpag Jun 12 '19 at 19:20
  • There is a way to access a file on a local computer via a UNC-like format without setting up a network share. You can use the following format: \\?\C:\my_path_to_a_file_or_folder to access a file or folder on the local C: drive. See also the answer of Jerzy below. – Beat Nideröst Feb 04 '22 at 07:38
35

On Windows, you can also use the Win32 File Namespace prefixed with \\?\ to refer to your local directories:

\\?\C:\my_dir

See this answer for description.

Community
  • 1
  • 1
Jerzy
  • 670
  • 6
  • 12
  • 8
    As you said, this is a path to a local directory, but it's not UNC (by itself), as per original question. To get a UNC path starting with `\\?\ ` you should use `\\?\UNC\localhost\my_shared_dir\ ` (still need to set up a share). – Alex Mazzariol Mar 24 '16 at 15:14
11

I had to:

wovano
  • 4,543
  • 5
  • 22
  • 49
xt_20
  • 1,406
  • 3
  • 13
  • 27