Click or drag to resize
PathLocalToUnc Method (String)
[AlphaFS] Converts a local path to a network share path.

A Local path, e.g.: "C:\Windows" will be returned as: "\\localhostname\C$\Windows"

If a logical drive points to a network share path, the share path will be returned.

Namespace: Alphaleonis.Win32.Filesystem
Assembly: AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax
public static string LocalToUnc(
	string localPath
)

Parameters

localPath
Type: SystemString
A local path, e.g.: "C:\Windows".

Return Value

Type: String
Returns a UNC path or when localPath is an empty string or .
Exceptions
ExceptionCondition
ArgumentExceptionThe path parameter contains invalid characters, is empty, or contains only white spaces.
ArgumentNullException
PathTooLongExceptionWhen localPath exceeds maximum path length.
NetworkInformationException
See Also