echo %date:.=%
This code will remove dots from the string with the current date. Can you consider the string that allows you to remove slashes?..
This is a blog of Dr.Batcher's development team. Dr.Batcher is the batch files creation and editing software providing you with the simplest way to create and edit batch files. So here you can find information on batch scripting techniques and development of Dr.Batcher.
/d[:mm-dd-yyyy] : Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
If you need to pass the current date to this command, you'll be surprised: on some configurations of the operating system %date% returns the current date in dd.mm.yyy format, while XCOPY requires mm-dd-yyyy. What to do? Here is some batch code that helps you to solve this problem:
@echo off
setlocal
set "dd=%date:~0,2%"
set "mm=%date:~3,2%"
set "yy=%date:~-2%"
xcopy c:\*.txt c:\temp /d:%mm%-%dd%-%yy%
