![]() ![]() But the date format of the environment variable DATE depends on Windows region and language settings. The usage of the environment variable DATE would be much faster than using the command WMIC. The FOR command line to get current date in format yyyyMMdd region independent is explained in detail for example at Why does %date% produce a different result in batch file executed as scheduled task? Rem The RAR/WinRAR command line to create the new archive with current date. If not exist "20?.rar" goto CreateDayArchiveįor /F "tokens=2 delims=." %%I in ('%SystemRoot%\System32\wbem\wmic.exe OS GET LocalDateTime /VALUE') do set "FileNameDate=%%I" I suggest the following batch file for your task: off I delete manually the backup archives no longer needed from time to time. WinRAR automatically creates RAR archive files with current date in format yyyy-MM-dd in file name with an incremented number because of NN, i.e. ![]() I use for archiving source files the switch -agYYYY-MM-DD_NN making it possible for me to create more than one individual archive per day for backup purposes. ![]() But I think it is not advisable to use WinRAR with command d to just delete an archive file before creating a new archive file with same name. WinRAR has the command d to delete files in an archive with deleting the archive file itself on finally not containing any file. WinRAR has no command or switch to ignore an existing archive file on compressing files and folders into an archive like all compression tools I'm aware of. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |