Search code examples
batch-filebatch-rename

Require a script to make a copy of all files in a folder and rename the copies to text files


I'm looking to run a batch file in a specific folder and copy all files in that directory and rename those copies including it's extension to .txt

I.e, if there are files called fhnbye.zip and 212obtr.xls I want it to make copies of it and rename it to fhnbye.zip.txt and 212obtr.xls.txt

Is that possible?


Solution

  • This is a plain batch task:

    @echo off
    pushd "c:\data\folder"
    echo creating "%%a.txt"
    for /f "delims=" %%a in ('dir /b /a-d ') do copy /y "%%a" "%%a.txt" >nul
    popd