batch re-write command

i know this " > " and " >>" comands in bat make and edit files. but i need to figure if its possible to make a bat file that can re-write file extensions ex- -a game i have ________ has .edf files. -my friend has the same game and i want to mess with im where those files are overwrote with "PWNed" -and i want the bat file to overwrite all the .edf files with out having each .edf files name 2nd ex- data01.edf data02.edf and so on, but i dont wanna add all the names into the bat file end 2nd ex. end 1st ex. im sure that it is something like pwned > *.edf or pwned >> *.edf am i close or way off?

zachninme8 years ago
Although I don't know use windows & don't know batch, you're asking the wrong question.
Instead, figure out how to find all the .edfs in a directory and do something with them.

Bash has for loops, and you could do something like:
for x in `echo *.edfdo echo $xdone
See if Batch has something similar?
spiker (author)  zachninme8 years ago
er. explain that out some plz
i am bash user too and familiar with windows cmd only slightly

most commands like '>' are stupid. they cannot work with more than 1 file at a time

so you have to run it yourself for every file you want to change

instead of including all the names of the files in the bat file it may be possible to make it autodetect all the files and run the command on each of them automatically

in bash this autodetection works like this - you give the command ls (its like dir in windows) and use the command for to run the actual command > automatically on each of the files that show up in the ls

the trick here is to use a do-again command (like for or goto) (called loop in advanced computing) together with the dir command or another way to fetch all file names