使CMD.exe支持UNC路径

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/kaifeng2988/article/details/50378151

修改注册表,使CMD.exe支持UNC路径

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

添加 DisableUNCCheck REG _ DWORD 值并将值设置为 0 x 1 (十六进制)

展开阅读全文

我想得到 网 络 驱 动 器 的UNC路径 ,如何做??????

06-26

rnrn 下面有一篇文章 我做了怎么不能用???rn得 到 一 个 网 络 驱 动 器 的 UNC路 径 (“ \\服 务 器 \共 享 路 径 ” )。 rn rn ' 32-bit Function version. rn ' Enter this declaration on a single line. rn Declare Function WNetGetConnection32 Lib "MPR.DLL" Alias _ rn "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal _ rn lpszRemoteName As String, lSize As Long) As Long rn rn ' 32-bit declarations: rn Dim lpszRemoteName As String rn Dim lSize As Long rn rn ' Use for the return value of WNetGetConnection() API. rn Const NO_ERROR As Long = 0 rn rn ' The size used for the string buffer. Adjust this if you rn ' need a larger buffer. rn Const lBUFFER_SIZE As Long = 255 rn rn Sub GetNetPath() rn rn ' Prompt the user to type the mapped drive letter. rn DriveLetter = UCase(InputBox("Enter Drive Letter of Your Network" & _ rn "Connection." & Chr(10) & "i.e. F (do not enter a colon)")) rn rn ' Add a colon to the drive letter entered. rn DriveLetter = DriveLetter & ":" rn rn ' Specifies the size in charaters of the buffer. rn cbRemoteName = lBUFFER_SIZE rn rn ' Prepare a string variable by padding spaces. rn lpszRemoteName = lpszRemoteName & Space(lBUFFER_SIZE) rn rn ' Return the UNC path (\\Server\Share). rn lStatus& = WNetGetConnection32(DriveLetter, lpszRemoteName, _ rn cbRemoteName) rn rn ' Check to see if WNetGetConnection() succeeded. WNetGetConnection() rn ' returns 0 (NO_ERROR) if it succesfully retrieves the UNC path. rn If lStatus& = NO_ERROR Then rn rn ' Display the UNC path. rn MsgBox lpszRemoteName, vbInformation rn rn Else rn ' Unable to obtain the UNC path. rn MsgBox "Unable to obtain the UNC path.", vbInformation rn End If rn End Sub rnrnrn这样可以吗?大家帮忙看看!!! 论坛

没有更多推荐了,返回首页