How do I change the extension of many files in a directory? [closed]

On Windows, go to the desired directory, and type:

ren *.txt *.c

In PowerShell, it is better to use the Path.ChangeExtension method instead of -replace (thanks to Ohad Schneider for the remark):

Dir *.txt | rename-item -newname { [io.path]::ChangeExtension($_.name, "c") }

For Linux (Bash):

for file in *.txt
do
 mv "$file" "${file%.txt}.c"
done