Link to home
Start Free TrialLog in
Avatar of Star Gazr1
Star Gazr1Flag for United States of America

asked on

Batch File redirect File Name

I  have a few tab delimited text files in a the same folder.  
Is there a way in a batch file to echo the name of a file to be redirected as a new field into that same file?
 I need to do this with a wildcard for all .txt files in a specific folder, for example with a file called:  File1.txt
File1.txt will get added to that file as a new field.
and so on for the rest of the files in the folder. Any ideas?   Thanks.
Avatar of Bill Prew
Bill Prew

Is there only one line in each text file, or multiples?

Do you just want the name of the file added, or the name and the extension, or the full path.

I would recommend VBS for this rather than BAT, is that okay?

~bp
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Star Gazr1

ASKER

@ billprew thanks for the info.
I don't need the extension or file path, just the name of the file echoed to each individual file in the folder.  There is more than 1 line Ideally, if I could echo the file name to all lines in each file. but if not than this will have to do for now.  I am not that familiar with VBS, but if it is easier to use this than I will give this a try.  I am going to keep my posting up to see if I get any other responses regarding doing this in Batch format.
I test the VBS code it works very well. Thanks so much!
Welcome, glad that helped.

~bp