Translating local path to a UNC ? 
Author Message
 Translating local path to a UNC ?

Have a local path, such as:
     strCurrentPath = fso.GetFolder(".").Path

Which returns something like:
    D:\Temp2\Scripts

And I'd like to translate it to something like:
    \\MyNode\D$\Temp2\Scripts

I could probably parse this and do it programmatically, but I am
hoping there is a function or object somewhere in the OS which
does this, perhaps less likely to break with future OS releases.

--
______________________________________________________________________
Lee Gillie, CCP                                Remove NOSPAM to E-Mail
Online Data Processing, Inc. - 3501 N. Haven -  Spokane, WA 99207-8500



Wed, 11 Sep 2002 03:00:00 GMT  
 Translating local path to a UNC ?

Quote:

> Have a local path, such as:
>      strCurrentPath = fso.GetFolder(".").Path

> Which returns something like:
>     D:\Temp2\Scripts

> And I'd like to translate it to something like:
>     \\MyNode\D$\Temp2\Scripts

> I could probably parse this and do it programmatically, but I am
> hoping there is a function or object somewhere in the OS which
> does this, perhaps less likely to break with future OS releases.

> --
> ______________________________________________________________________
> Lee Gillie, CCP                                Remove NOSPAM to E-Mail
> Online Data Processing, Inc. - 3501 N. Haven -  Spokane, WA 99207-8500

Look at the WSH Network object's EnumNetworkDrives and VBScript's
GetDriveName method.  For example, ...

Set ofs = CreateObject("Scripting.FileSystemObject")
sDrv = ofs.GetDriveName("D:\Temp2\Scripts")
Set oWN = WScript.CreateObject("WScript.Network")
Set oDrvs = oWN.EnumNetworkDrives
i = 0
Do While i < oDrvs.Count
  if oDrvs.Item(i) = sDrv Then
    WScript.Echo oDrvs.Item(i), oDrvs.Item(i + 1)
    Exit Do
  Else
    i = i + 2
  End if
Loop

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/



Fri, 13 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Converting local path to UNC path?

2. UNC Path and the local System Account

3. Converting logical paths to UNC paths

4. Converting logical paths to UNC paths

5. Problem using FileSystemObject and UNC paths

6. Filesystem object UNC Path Error

7. bug vbs 5.6 FSO with UNC path

8. UNC Path Names

9. UNC Path

10. Copy file to UNC path?

11. Detect if a path is a UNC

12. RegWrite - Key is UNC Path

 

 
Powered by phpBB® Forum Software