Hi,
I am writing a bat file to create a folder on the desktop in the format MYOB_YYYYMMDD.
When I run the file all I get is a folder on the desktop with the name MYOB_022, I am not getting the full date.
Any help is greatly appreciated
@echo off
:: Setting YYYYMMDD
for /f "skip=1 tokens = 2-4 delims = (-)" %%a in ('echo/^|date') do (for /f "tokens = %t%-4 delims=.-/ " %%d in ('date/t') do (set %%a=%%d&set %%b=%%e&set %%c=%%f))
:: Create folder with date on Desktop
mkdir "C:\Users\michael.smith\Desktop\MYOB_%date:~10,4%%date:~7,2%%date:~4,2%"
:: move from docs to desktop
robocopy C:\Users\Public\Documents\MYOB "C:\Users\michael.smith\Desktop\MYOB_%date:~10,4%%date:~7,2%%date:~4,2%" /SEC /Z /E /log:C:\Users\michael.smith\Desktop\create_folder_copy_YYYYMMDD.txt /tee