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
Frage
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?
Lösung
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
Andere Tipps
OK, not to complicated, but there are some things you need to fill out before you can run this batch file (make sure its run in the same directory):
@echo off
set dir="C:\users\...[path to copy target (that is NEW location)]"
copy *.* %dir%\*.txt
And DONE!
Note, it will ask you for permission to overwrite files, if you have more then one file with the same name.
This code uses forfiles
and will only work on windows 7 if you have windows tool installed (most computers will)
@echo off
set dir="C:\users\...[path to copy target (that is NEW location)]"
forfiles /c "cmd /c (copy @file %dir%\@file.txt)"
It should work fine.
Mona