GetLocal - Get local mapped drive from UNC Path  v1.0

Copyright (c) 2004-2007 Gerald W. Gaston

Revision History:
v1.0 - Created.


------------------------------------------------------------------------------
Terms of Use:

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED. USE AT YOUR OWN RISK.

YOU MAY NOT DISTRIBUTE GETLOCAL WITHOUT THE EXPRESS WRITTEN PERMISSION OF GERALD W. GASTON.

------------------------------------------------------------------------------

GetLocal is a simple console utility that returns the local drive letter mapped to the UNC path provided. If multiple drives are mapped, the first one mapped
(not necessarily the lowest letter) is returned. If no drive is mapped to the UNC path, then ERROR_NOT_CONNECTED is returned.


Syntax:
------------------------------------------------------------------------------
GETLOCAL UNC_path


Notes:
------------------------------------------------------------------------------
UNC path passed to GetLocal is not case sensitive.
GetLocal is not smart enough to know that a particular NetBIOS name, FQDN, or IP Address are all the same host. It must have bee mapped as the UNC path you passed.


Exit codes:
------------------------------------------------------------------------------
0   - Successfully resolved UNC path to a drive letter.
1   - Unsuccessful in resolving UNC path to a drive letter.
9   - All other errors (including showing help).



Examples:
------------------------------------------------------------------------------
GetLocal.exe \\myserver\myHomeDir$
H:

echo.%errorlevel%
0


GetLocal.exe \\myserver\Bogus
NOT_FOUND

echo.%errorlevel%
1


Copyright © 2004-2007 Gerald's Tools