查找共享的目录规范 [英] Finding a share's directory spec
问题描述
大家好,
我正在编写一项服务,需要在启动时找到基于本地共享的
的完整目录路径。 IOW,我需要在someserver上运行服务
才能获取\\someserver \ someshare,并给我
c:\somedir \somedir \ Shareddir 。
我不太清楚从哪里开始阅读如何做到这一点。可以
有人给我推进正确的方向吗?
谢谢。
ne。
Hi all,
I''m writing a service that needs to discover the full directory path for a
given locally based share at startup. IOW, I need to have the service
running on someserver to take \\someserver\someshare and give me
c:\somedir\somedir\shareddir.
I''m not quite sure where to start reading about how to do this. Could
someone give me a push in the right direction, please?
Thank you.
ne.
推荐答案
4月27日上午10点39分,NetworkElf < Network ... @nospam.nospamwrote:
On Apr 27, 10:39 am, "NetworkElf" <Network...@nospam.nospamwrote:
大家好,
我正在写一项服务需要在启动时发现基于本地共享的
的完整目录路径。 IOW,我需要在someserver上运行服务
才能获取\\someserver \ someshare,并给我
c:\somedir \somedir \ Shareddir 。
我不太清楚从哪里开始阅读如何做到这一点。可以
有人给我推进正确的方向吗?
谢谢。
ne。
Hi all,
I''m writing a service that needs to discover the full directory path for a
given locally based share at startup. IOW, I need to have the service
running on someserver to take \\someserver\someshare and give me
c:\somedir\somedir\shareddir.
I''m not quite sure where to start reading about how to do this. Could
someone give me a push in the right direction, please?
Thank you.
ne.
一个真正的kludgy方法是启动一个命令提示符
窗口进程,将它提供给NET SHARE< ;共享名称>"命令和解析
路径的输出。
A real kludgy way to do it would be to fire off a Command Prompt
Window process, feed it the "NET SHARE <sharename>" command and parse
the output for the path.
< za *** @ construction-imaging.com写信息
新闻:11 ********************** @ r35g2000prh.googlegr psps.com .. 。
<za***@construction-imaging.comwrote in message
news:11**********************@r35g2000prh.googlegr oups.com...
4月27日上午10:39,NetworkElf < Network ... @nospam.nospamwrote:
On Apr 27, 10:39 am, "NetworkElf" <Network...@nospam.nospamwrote:
>我正在编写需要的服务在启动时发现基于本地共享的完整目录路径
。 IOW,我需要在某个服务器上运行该服务才能获取\\someserver \ someshare分享并给我
c:\somedir \somedir \ Shareddir。
>I''m writing a service that needs to discover the full directory path for
a
given locally based share at startup. IOW, I need to have the service
running on someserver to take \\someserver\someshare and give me
c:\somedir\somedir\shareddir.
I''m not quite sure where to start reading about how to do this. Could
someone give me a push in the right direction, please?
一个真正的kludgy方法是启动命令提示符
窗口进程,将其提供给NET SHARE< ;共享名称>"命令和解析
路径的输出。
A real kludgy way to do it would be to fire off a Command Prompt
Window process, feed it the "NET SHARE <sharename>" command and parse
the output for the path.
我考虑过这一点,但我决定宁愿避开那条路线能够。我是
某些功能在vb.net中,我还没有找到
我还需要什么。
谢谢。
I had considered that, but decided I''d rather avoid that route if I can. I''m
certain the functionality is within vb.net, I''ve just not been able to find
what I need yet.
Thank you.
NetworkElf写道:
NetworkElf wrote:
>
我考虑过这一点,但我决定如果可以的话我宁愿避开这条路线。我是
某些功能在vb.net中,我还没找到
我还需要什么。
>
I had considered that, but decided I''d rather avoid that route if I can. I''m
certain the functionality is within vb.net, I''ve just not been able to find
what I need yet.
有一个wmi类win32_ShareToDirectory。
为wsh / vbs找到了scriptomatic。
这是我未经测试的尝试转换为vb.net
''wmi Win32_ShareToDirectory类允许您获取该信息
''您需要添加一个这个例子引用了System.Management。
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject
moSearch = New Management.ManagementObjectSearcher(_
" Select * from Win32_ShareToDirectory")
moReturn = moSearch.Get
每个mo in moReturn
Debug.WriteLine(mo(" Share"))
Debug.Indent()
调试.WriteLine(mo(" SharedElement")))
Debug.Unindent()
下一页
HTH
-
问候
Matthias
There is a wmi class win32_ShareToDirectory.
Found it with scriptomatic for wsh/vbs.
This is my untested try to convert to vb.net
'' The wmi Win32_ShareToDirectory class allows you to get that information
'' You need to add a reference to System.Management for this example.
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject
moSearch = New Management.ManagementObjectSearcher(_
"Select * from Win32_ShareToDirectory")
moReturn = moSearch.Get
For Each mo In moReturn
Debug.WriteLine(mo("Share"))
Debug.Indent()
Debug.WriteLine(mo("SharedElement"))
Debug.Unindent()
Next
HTH
--
Greetings
Matthias
这篇关于查找共享的目录规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!