Looking for a little help, i have a text file containing UNC paths, all paths have a specific delim i can use to find where the path should end (so i can mount the parent UNC path as a drive)
Example text file
\\myunc.myunc.com\parent1\parent2\location_1\blah\blah\
\\myunc.myunc2.com\parent1\location_1\blah\blah\
\\myunc.myunc2.com\parent1\parent2\parent3\parent4\location_1\blah\
in theory i need it to parse this text file, and output the paths as
\\myunc.myunc.com\parent1\parent2\
\\myunc.myunc2.com\parent1\
\\myunc.myunc2.com\parent1\parent2\parent3\parent4\
i need to find the _ and remove the path string in front of it until \
--
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO GRABBING UNC PATHS
ECHO.
FOR /F "tokens=1 delims=_" %%b in (pathdumpunc.txt) do (
SET UNCPATH=%%b
ECHO !UNCPATH!
for %%a in (!UNCPATH!) do set LastFolder=%%~nxa
ECHO !LastFolder!
PAUSE
)
ive gone as for as identifying the last folder path name, but thats as far as ive gotten, and it seems the "LastFolder=%%~nxa" line takes forever to run , like 10+ seconds.
any help would be apprecited.