pdaughe Posted March 16, 2007 Share Posted March 16, 2007 Hi,It's always easier to advise someone when you know what they're trying to do, so I'll try to briefly explain: Two computers: A and B.On computer B, a script creates a folder of shortcuts to files on computer B.The folder (containing the shortcuts) is shared on the home network.In order for computer A to successfully access the shortcut files in the folder, the shortcut targets must be UNC paths.Instead of: C:\Documents and Settings\UserName\My Documents\My Music\Artist\Song.mp3use:\\FamilyComputer\My Documents\My Music\Artist\Song.mp3My question is: How can the script which runs on computer B best determine what the UNC path name (as seen from computer A) would be for the shortcut target? I searched the forums and found lots of information w.r.t. DriveMap, but note that no drives are mapped (or need to be mapped) between the two computers.One post referred to WnetGetUniversalName, but that was over my head.Your advice would be greatly appreciated.Sincerely,Paul Link to comment Share on other sites More sharing options...
Joon Posted March 16, 2007 Share Posted March 16, 2007 Can you just use ShellExecute("\\FamilyComputer\My Documents\My Music\Artist\Song.mp3") ? or you need to create a shortcut? Link to comment Share on other sites More sharing options...
pdaughe Posted March 16, 2007 Author Share Posted March 16, 2007 (edited) Can you just use ShellExecute("\\FamilyComputer\My Documents\My Music\Artist\Song.mp3") ? or you need to create a shortcut?Thanks -- the goal is for computer A to read the shared folder that contains the shortcuts. No problem with that, but the shortcut TARGET has to be a UNC path name. Once you have the UNC path name (on computer A), computer A could then do the ShellExecute or whatever. Edited March 16, 2007 by pdaughe Link to comment Share on other sites More sharing options...
Joon Posted March 16, 2007 Share Posted March 16, 2007 I see what you want to do now... If you are not concerned about the the secruity, easiest way is share out the root folder. Then if your shortcut says "C:\Documents and Settings\UserName\My Documents\My Music\Artist\Song.mp3" replaace with "\\Computer A\C$\Documents and Settings\UserName\My Documents\My Music\Artist\Song.mp3" Link to comment Share on other sites More sharing options...
pdaughe Posted March 16, 2007 Author Share Posted March 16, 2007 I see what you want to do now... If you are not concerned about the the secruity, easiest way is share out the root folder.Then if your shortcut says "C:\Documents and Settings\UserName\My Documents\My Music\Artist\Song.mp3"replaace with "\\Computer A\C$\Documents and Settings\UserName\My Documents\My Music\Artist\Song.mp3"Yes, it's easy for me to change the script and hard-code the correct UNC path name. I'd like to be able to run this script on ANY computer. For example, my brother has a home network -- same consideration....The question is: I have a path name. What is the UNC path name? Of course, there only is a valid UNC path name if the folder that the file actually resides in is shared, which is the heart of the question. Link to comment Share on other sites More sharing options...
pdaughe Posted March 16, 2007 Author Share Posted March 16, 2007 Isn't there some way to enumerate all the shares on a system? If so, then if the path for that share could be determined, the question could be answered! Link to comment Share on other sites More sharing options...
jinxter Posted March 19, 2007 Share Posted March 19, 2007 (edited) c$ share requires you to login as an admin (if you have the same user with the same password it will work aswell) same with admin$ share. HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares holds your other shares, with permissions. These values can be read with either reg.exe or RegEnumVal(), depends on your preference. Edited March 19, 2007 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
pdaughe Posted March 19, 2007 Author Share Posted March 19, 2007 c$ share requires you to login as an admin (if you have the same user with the same password it will work aswell) same with admin$ share.HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares holds your other shares, with permissions. These values can be read with either reg.exe or RegEnumVal(), depends on your preference.Thanks a bunch Jinxter -- answers the question EXACTLY.The lanmanserver\Shares entries contain the full path name for a given share. On the computer I'm running on, given a path name, I can ask the question: is the folder shared or a higher-level folder in the path shared? If so, I create the shortcut using the computer name and the share name, followed by the rest of the path nodes.Now I can share the folder that contains the shortcuts and the shortcut targets will be valid on any computer in the home network. Great!Thanks again, so very much.Paul Link to comment Share on other sites More sharing options...
jinxter Posted March 19, 2007 Share Posted March 19, 2007 Glad to be of service > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now