Move file and add timestamp to filename using DOS command script Options

davegate 194 - 978
@2020-01-20 13:27:33

The following DOS command script will move a file to different folder and add timestamp to the new filename at same time:

    @echo off
    for /f %%a in ('powershell -Command "Get-Date -format yyyy_MM_dd__HH_mm_ss"') do set datetime=%%a

    rem echo copying file

    move "c:\temp\test.txt" "c:\temp\archive\test-%datetime%.txt"

    rem echo done
 
Users browsing this topic
Guest