Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I'd like to achieve in the end is to generate a text file that lists all *.txt files in the current directory with the path appended to the beginning of the filenames, and some other string after the filenames.

ie.

C:\path\first.txt string

C:\path\second.txt string

C:\path\third.txt string

As of now all I can think of is to use

dir /b *.txt

and some sort of regex code to append the strings, but unsure how to. If it matters, the path and string at the end are the same for all lines.

Thank you!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Create a batch file e.g:

script.bat:

@echo off
for %%i In (*.txt) DO echo %CD%\%%i string

then simply run script.bat from the directory where you want to list the files and append the string

share|improve this answer
    
That works. Thank you! –  csg Sep 6 '13 at 20:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.