Sign in to follow this  
Followers 0
lyledg

Detect UNC paths?

6 posts in this topic

I am currently writing a proggie for work which needs to detect the UNC Paths rather than the Drive letters that I am currently connected to, and then I need to add these paths to a list box.

Is there a easy way to do this?

Thanx

;)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am currently writing a proggie for work which needs to detect the UNC Paths rather than the Drive letters that I am currently connected to, and then I need to add these paths to a list box.

Is there a easy way to do this?

Thanx

;)

"net use" will print the mapped drives and the UNC names. Run "net use" with RunWait() and parse the output.

EDIT: Even better, if you know the drive letter: "net use x:" will print the UNC path for the drive letter x:

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Just like:?

$drives = DriveGetDrive("network")
If IsArray($drives) Then
   For $i = 1 To $drives[0]
      $unc = DriveMapGet($drives[$i])
      Msgbox(0, $drives[$i], $unc)
   Next
EndIf

Regards

Holger

Edited by Holger

Share this post


Link to post
Share on other sites

Just like:?

$drives = DriveGetDrive("network")
If IsArray($drives) Then
   For $i = 1 To $drives[0]
      $unc = DriveMapGet($drives[$i])
      Msgbox(0, $drives[$i], $unc)
   Next
EndIf

Regards

Holger

Well, I really love to run commandline tools and to parse the output. I guess that's more like the unix way than the windows way to solve problems... ;):P

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

I use this code to resolve the drive of a file. If DriveMapGet has an error then the file is local, if it is mapped the the drive is converted to UNC and if UNC alreday it stays like that. This allows me to email links to mapped files without having to edit out the drive and convert it to a server, which I do often. Hope it helps. It is from my Explorer CM3Utility context menu tool at: My AU3 Projects

$Drive = StringLeft($CMDLINE[2], 2)
$Msg = DriveMapGet($Drive)
If @error = 0 Then
    $Msg = StringReplace($CMDLINE[2], $Drive, $Msg)
Else
    $Msg = $CMDLINE[2]
EndIf
ClipPut($Msg)

Share this post


Link to post
Share on other sites

Thanks guys, all your answers helped me!

Cheers

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0