Solved Extraction of a substring with a loop

April 14, 2015 at 21:06:19
Specs: Windows 7
In the Loop:

FOR /R %source% %%X IN (*.cmd) DO (
....
)

%%X is given the value of the complete path which is what I need
But how can I extract and display only the file name within the loop?


See More: Extraction of a substring with a loop

Report •

#1
April 14, 2015 at 23:05:54
✔ Best Answer
::====== script starts here ===============
::
:: bernie.bat 2015-04-15 12:35:07.27
@echo off & setLocal enableDELAYedeXpansioN

set source=c:\bb

FOR /R %source% %%X IN (*.cmd) DO (
echo.%%X
echo.%%~NX
)
goto :eof
::====== script ends here =================

=====================

M2 Get custom script or take private lessons


Report •

#2
April 15, 2015 at 08:11:54
Thanks. Works like a dream!!

Report •
Related Solutions


Ask Question