rem this batch file is a simple source control, just backup your .cpp and .h to a backup profix dir, Rebol contribute. @echo off rem if file.txt exists, del it first @if exist file.txt del file.txt rem first extract file goto :NotDone :Input set /p version=backup date: echo %version% rem backup the source file first if exist Backup_%version% ( echo you have already Backup under "Backup_%version%", change your input pls,*_* goto :Input ) if not exist Backup_%version% ( mkdir Backup_%version% && for /f %%a in (file.txt) do copy /Y %%a .\Backup_%version%\%%a ) goto:eof :NotDone echo not done for /f "tokens=1,2 delims=." %%a in ('dir /b') do ( call set filename=%%a.%%b && call:%%b 2>nul ) goto :Input :cpp :h rem the %%a and %%b is out of effect here echo %filename% >> file.txt