1.

Solve : bat scipt to input text from another file?

Answer»

im not very GOOD with this but can SOMEONE help me with the following. i'm trying to do something with mame arcade driver files. i have a text file names drivers.txt with words listed like below...

SNES_ClassicKong
C64_Artillery
C64_BadStreetBrawler
etc.

i need a batch script that would take these words and make another txt file outputting them like below...

ROM_START( SNES_ClassicKong )
ROM_END

ROM_START( C64_Artillery )
ROM_END

ROM_START( C64_BadStreetBrawler )
ROM_END


try
Code: [Select]for /f "delims=" %%A in (drivers.txt) do (
echo ROM_START( %%A ^) >>OutputFile.txt
echo ROM_END >>OutputFile.txt
echo. >>OutputFile.txt
)
worked pperfect thank you so MUCH. if dont MIND me asking what is everything in the first line doing. and thank you again

for /f "delims=" %%A in (drivers.txt) do (Quote from: daillest319 on October 09, 2012, 10:40:49 AM

worked pperfect thank you so much. if dont mind me asking what is everything in the first line doing. and thank you again

for /f "delims=" %%A in (drivers.txt) do (
From the FOR help.
Code: [Select]FOR /F ["OPTIONS"] %variable IN (file-set) DO command [command-parameters]

filenameset is one or more file names. Each file is opened, read
and processed before going on to the next file in filenameset.
Processing consists of reading in the file, breaking it up into
individual lines of text and then parsing each line into zero or
more tokens.If you need more info on for loops, type 'for /?' in cmd, to get a 3 page explanation on the different types and how they work.


Discussion

No Comment Found