Renaming a file with variables in path

December 4, 2010 at 03:02:50
Specs: Windows XP

REM Set backup drive path
set drive=F:\BACKUP\StMathias\
set fullDrivePath=%drive%%cur_ddmmyyyy%

REM Create new bkup dir based on date
if not exist %fullDrivePath% mkdir %fullDrivePath%

The above works fine, but then I cant create another directory like this

mkdir %fullDrivePath%\Registry

the error message I get is:

A subdirectory or file F:\BACKUP\StMathias\01122010 already exists.
Error occurred while processing: F:\BACKUP\StMathias\01122010.
A subdirectory or file \Registry already exists.
Error occurred while processing: \Registry.

...but if I spell it out, the following works

mkdir F:\BACKUP\StMathias\04122010\Registry

Im new to xp dos. It seems such a simple script.
Can anyone help?

Rgds
Malc


See More: Renaming a file with variables in path

Report •

#1
December 4, 2010 at 11:34:44
set fullDrivePath=%drive%%cur_ddmmyyyy%
There's a space at the end of this line. Remove it.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question