Hi all. Was after some more help and advice. My little project just keeps on growing and I always get side tracked when I wish to learn summet new. What I would like to know is,,,,, Is it possible to add lines to an existing .txt file... Exaample if i had this text doc (my "makelist.cmd" gave me this .txt.....hark at me...) i want to add for example "= 1980,,,,,,,1980,0,0" to each line and end up with the following .txt I have been doing it one line at a time and some of my .txt have quite a few lines in them so being able to run a .cmd and have the lines added and a new .txt file made would be great. tried to find how to do this on the net but all I see is gobbeldy gook and I dont understand it.... So any help,tips and pointer will be fantatstic....
I would use powershell, heres an example that will replace = with = 1980,,,,,,,1980,0,0 in a file named test.txt: Code: type test.txt | powershell -Command "$input | ForEach-Object { $_ -replace \"=\", \"= 1980,,,,,,,1980,0,0\" } > test.txt"
Hi Aphawaves... This works fine and wow,it's prety cool. butttttttttttt One ikkle problem....The lines on my text file do not end with "=" They are just the file name and ext "viahub3.cat" If I manually add a "=" to each line your code works a treat. Been looking at it and it uses "-replace". i have been looking at powershell commands and there is an "add-content" I have no idea if this will work,I have tried just replacing repalce with add-content but no luck. I simply removed the "=" from your code and the gates of hell open up in the test.txt. i tried "" and all the lines dissapear,like magic..... I will read up more on the power shell commands....never even heard of them till just now... cheers..
Ok try this to append each end of line: Code: type test.txt | powershell -Command "$input | ForEach-Object {$_ -replace \"$\", \" = 1980,,,,,,,1980,0,0\"} | out-file test.txt"
Alphawaves.. You are a genius. I have no idea what any of that means and i just wish i did. Alphawaes the scripting wizard