Writing script to backup selected directories from my hard drive (C:) onto an exteal hard drive using XCOPY.
All went well when I used the same directory name on both source and destination. But when I tried to get a bit clever and make the destination a subdirectory of a dated main directory called "Archive", I keep getting an "Invalid path" error. Here's an exerpt of what I'm trying to do:
set/P Drive= Enter destination drive (with colon):
::
set BACKUPCMD= xcopy /S /D /I /Y /Q /C /T
::
set hour=%time:~0,2%
if "%hour:~0,1%"==" " set hour=0%time:~1,1%
SET dateNtime=%date:~10,4%-%date:~4,2%-%date:~7,2 %__%hour%:%time:~3,2%
::
set directory=TEST
set source=%directory%
set destination=%Drive%ARCHIVE_%dateNtime%%directory%
%BACKUPCMD% "C:%source%*.*" "%destination%"
Could somebody help me with my syntax? Thanks
برچسب:
نویسنده: استخدام کار