Solved Removing directory paths in a .txt file

May 17, 2014 at 11:58:59
Specs: Windows 64
Is there a similar way to remove the directory paths and leave the filenames intact in a text file just like the below command can be used to remove the filename while leaving the directory path in a .txt file:

@echo off & setlocal
(for /f "tokens=*" %%a in (file.txt) do echo %%~dpa)>tmp.1
del filem.txt
rename tmp.1 file.txt


See More: Removing directory paths in a .txt file

Report •

#1
May 17, 2014 at 21:42:36
✔ Best Answer
(for /f "tokens=*" %%a in (file.txt) do echo %%~nxa)>tmp.1

Report •
Related Solutions


Ask Question