1.

Solve : Have a Batch file create a directory with the systems date?

Answer»

My company has a certification AUDIT coming up and I have to show that I can RESTORE files from our BACKUP solution to each server. I am trying to have arcserve restore the same file to every server however I would like each restore to be placed in a directory with the current date. I can run a batch before the restore takes PLACE but I am having problems creating a directory with the systems date.

Thankshi,

if you type "date /t" at a command prompt it will give you the system date.

to use in a varaible, so you can make directroy,


set today=%date%

the you can, "mkdir C:\path\to\folders\%today%"


Hope it helps.

EDIT;

Thinking about it, this won't work as the %today% will have "/" in them which aren't supported as folder names. You've have to cut it up and rebuild the varaibale as an name that you can make a folder out of.

ie;

Code: [Select]@echo off

set today=%date%
echo %today%
set day=%today:~0,2%
set MONTH=%today:~3,2%
set year=%today:~6,4%
set newdate=%day%%month%%year%
echo %newdate%
pause

Then you can mkdir %newdate%





Discussion

No Comment Found