Hi everyone, I'm trying to extract some directory name from an existing text file, for example the contain of mytext.txt is : Code: Drive : System List Directory : System:\Backup\Scripting\PHP\header.php List Directory : System:\Backup\Scripting\PHP\content.php List Directory : System:\Backup\Scripting\PHP\footer.php List Directory : System:\Backup\Scripting\HTML\header.php List Directory : System:\Backup\Scripting\HTML\content.php List Directory : System:\Backup\Scripting\HTML\footer.php someone can help so I can output only the content directory inside scripting (eg "PHP" and "HTML" without included the file inside)? the problem I faced is, using findstr need to know the string first, but here, "PHP" or "HTML" need to search by read mytext.txt... thx in advance...
This all seemed to be pretty good advice... msfn.org/board/topic/170535-cmd-extract-specific-string-in-text-file/
not sure if this is what your looking to do but: Crate a new bat file "filename.bat" Code: FOR /F "tokens=5 delims=\" %%i in (php.txt) do ( ECHO %%i >> newfile.txt ) when run from cmd: Code: H:\>test.bat H:\>FOR /F "tokens=5 delims=\" %i in (php.txt) do (ECHO %i 1>>newfile.txt ) H:\>(ECHO header.php 1>>newfile.txt ) H:\>(ECHO content.php 1>>newfile.txt ) H:\>(ECHO footer.php 1>>newfile.txt ) H:\>(ECHO header.php 1>>newfile.txt ) H:\>(ECHO content.php 1>>newfile.txt ) H:\>(ECHO footer.php 1>>newfile.txt ) H:\> and will produce a text file call 'newfile.txt' that reads: Code: footer.php header.php content.php footer.php header.php content.php footer.php Hope that helps