Computing.Net > Forums > Disk Operating System > Batch for backup purposes

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch for backup purposes

Reply to Message Icon

Name: Dennis Duck
Date: February 29, 2004 at 17:25:32 Pacific
OS: win2k sp4
CPU/Ram: AMD 2100+ / 512 DDR
Comment:

Hi everyone,

I wanna make a batch file so i can schedule it in windows. Most part works. Just not the copy to the directory. I got problems with directories with spaces in it. Trying to solve that made more problems. Im also not sure if the copy routine works because i get the error everytime :)

Here is the code. And below the text file is use as source.


@echo off

for /F "tokens=1-4 delims=/ " %%A in ('date /t') do (
set Dow=%%A&set MM=%%B&set DD=%%C&set YYYY=%%D)

set tdir=%DD%%MM%%YYYY%


if exist i:\backup\%tdir%\ goto End
if not exist i:\backup\%tdir%\ md "i:\backup\%tdir%"

for /F "usebackq eol=; " %%A in (i:\backup\list.txt) do xcopy /E /V %%A %tdir%

:End

set tdir=
set Dow=
set MM=
set DD=
set YYYY=
set uur=
set mi=


Text file (list.txt)

C:\Documents and Settings\Dennis\Favorites\';
I:\Backup\boe\




Sponsored Link
Ads by Google

Response Number 1
Name: Wengier
Date: February 29, 2004 at 18:02:59 Pacific
Reply:

Hi Dennis, you are asking a NT (WinNT/2K/XP) batch file programming + Windows XP schedule question, but this is DOS forum. So you have asked your question in a *wrong* forum. Please note that Windows 2000 does not include "DOS". The "Command Prompt" in Win2K is just the NT (WinNT/2K/XP) system console, which is NOT DOS. Also, DOS batch and NT batch are different batch languages. Your NT batch scripts above will NOT work in DOS at all! For example, the following NT batch command is totally unacceptable in DOS:

"for /F "tokens=1-4 delims=/ " %%A in ('date /t') do (set Dow=%%A&set MM=%%B&set DD=%%C&set YYYY=%%D)"

Below is the *quotation* from the warning messages of this forum:

"DO NOT post questions related to NT Batch scripting on this forum. Use the Programming forum.

Use the Windows NT, 2000 or XP forum for questions regarding the Windows NT, 2000 or XP "DOS" command prompt."

For more information about the "Command Prompt" (Win32 Console) in WinNT/2K/XP, you may read this page:

http://mywebpages.comcast.net/stewartb/cmdprompt.html


0

Response Number 2
Name: Wengier
Date: February 29, 2004 at 19:35:23 Pacific
Reply:

OK. This thread has been redirected to the Windows 2000 Forum:

http://www.computing.net/windows2000/wwwboard/forum/56431.html


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Nutshell Database DOS to WIndows



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch for backup purposes

Globally change password for schedu www.computing.net/answers/dos/globally-change-password-for-schedu/14127.html

uses for 286? www.computing.net/answers/dos/uses-for-286/10233.html

DOS copy problem www.computing.net/answers/dos/dos-copy-problem/12420.html