Skip to content

Commit

Permalink
Get the full UNC path for the specified mapped drive path
Browse files Browse the repository at this point in the history
  • Loading branch information
maphew committed Apr 21, 2021
1 parent 60bb9cd commit d37f536
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions other/get-unc-path.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@if [%1]==[] goto :Usage
@setlocal enabledelayedexpansion
@set _NetworkPath=
@pushd %1
@for /f "tokens=2" %%i in ('wmic path win32_mappedlogicaldisk get deviceid^, providername ^| findstr /i "%CD:~0,2%"') do @(set _NetworkPath=%%i)
@echo.%_NetworkPath%
@popd
@goto :EOF
:: ---------------------------------------------------------------------
:Usage
@echo.
@echo. Get the full UNC path for the specified mapped drive path
@echo.
@echo. %~n0 [mapped drive path]

0 comments on commit d37f536

Please sign in to comment.