What is wrong with this BAT File?

R

RScotti

Hi,
I Have a problem with this bat file the two strings with the ** don't work and I can't see what is wrong with them.
I also included the two "Invalid path"errors that they produced.
Any help would really be appreciated. It's really driving me crazy!
@echo off
xcopy /s /y /d /h /c "C:\Program Files\Agent" "J:\Agent\"
xcopy /s /y /d /h /c "C:\Program Files\Agent" "C:\Documents and settings\HP_Administrator\My Documents\Agent\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My Documents\Documents\" "J:\My Documents\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My Documents\My Pictures\" "J:\My Pictures\"
xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\Cookies" "J:\Cookies\"
xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\Favorites" "J:\Favorites\"
xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My Documents\Backup" "J:\Backup\"
xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My Documents\Backup" "J:\ABackup\"

This is the errors the ones with the **:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\HP_Administrator>b
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
**>Invalid path
**>0 File(s) copied
**>Invalid path
**>0 File(s) copied
C:\Documents and settings\HP_Administrator\Cookies\index.dat
Access denied
0 File(s) copied
0 File(s) copied
0 File(s) copied
0 File(s) copied

C:\Documents and Settings\HP_Administrator>

Have a good day,
RScotti

remove "nospam" in order to email me.
 
N

Nepatsfan

RScotti said:
Hi,
I Have a problem with this bat file the two strings with the
** don't work and I can't see what is wrong with them. I
also included the two "Invalid path"errors that they
produced.
Any help would really be appreciated. It's really driving me
crazy!
@echo off
xcopy /s /y /d /h /c "C:\Program Files\Agent" "J:\Agent\"
xcopy /s /y /d /h /c "C:\Program Files\Agent" "C:\Documents
and settings\HP_Administrator\My Documents\Agent\"
**>xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\Documents\" "J:\My
Documents\"
**>xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\My Pictures\" "J:\My
Pictures\"
xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\Cookies" "J:\Cookies\"
xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\Favorites" "J:\Favorites\"
xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\Backup" "J:\Backup\"
xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\Backup"
"J:\ABackup\"

This is the errors the ones with the **:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\HP_Administrator>b
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
**>Invalid path
**>0 File(s) copied
**>Invalid path
**>0 File(s) copied
C:\Documents and settings\HP_Administrator\Cookies\index.dat
Access denied
0 File(s) copied
0 File(s) copied
0 File(s) copied
0 File(s) copied

C:\Documents and Settings\HP_Administrator>

Have a good day,
RScotti

remove "nospam" in order to email me.

Lose the trailing backslashes.

xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\Documents" "J:\My
Documents"

xcopy /s /y /d /h /c "C:\Documents and
settings\HP_Administrator\My Documents\My Pictures" "J:\My
Pictures"

Good luck

Nepatsfan
 
P

Pegasus \(MVP\)

RScotti said:
Hi,
I Have a problem with this bat file the two strings with the ** don't work
and I can't see what is wrong with them.
I also included the two "Invalid path"errors that they produced.
Any help would really be appreciated. It's really driving me crazy!
settings\HP_Administrator\My Documents\Agent\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My
Documents\Documents\" "J:\My Documents\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My
Documents\My Pictures\" "J:\My Pictures\"Documents\Backup" "J:\ABackup\"
This is the errors the ones with the **:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\HP_Administrator>b
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
**>Invalid path
**>0 File(s) copied
**>Invalid path
**>0 File(s) copied
C:\Documents and settings\HP_Administrator\Cookies\index.dat
Access denied
0 File(s) copied
0 File(s) copied
0 File(s) copied
0 File(s) copied

C:\Documents and Settings\HP_Administrator>

Have a good day,
RScotti

remove "nospam" in order to email me.

This syntax is fine:
xcopy "SourceDir" "DestDir\"
The trailing backslash for the destination directory means
that xcopy will create DestDir unless it already exists.

This syntax is also OK:
xcopy "SourceDir\*.*" "DestDir\"

This syntax is not OK (as Nepatsfan mentioned):
xcopy "SourceDir\" "DestDir\"
 
R

RScotti

Thank you both so much.
That was the problem.I didn't even notice that.I really appreciate the help I get in these MS Newsgroups I would
definitely be lost without them.

Thanks again.

RScotti said:
Hi,
I Have a problem with this bat file the two strings with the ** don't work
and I can't see what is wrong with them.
I also included the two "Invalid path"errors that they produced.
Any help would really be appreciated. It's really driving me crazy!
settings\HP_Administrator\My Documents\Agent\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My
Documents\Documents\" "J:\My Documents\"
**>xcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My
Documents\My Pictures\" "J:\My Pictures\"Documents\Backup" "J:\ABackup\"
This is the errors the ones with the **:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\HP_Administrator>b
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
C:\Program Files\Agent\Data\MWORDS.DAT
C:\Program Files\Agent\Data\MWORDS.IDX
C:\Program Files\Agent\Data\tasklog.xml
3 File(s) copied
**>Invalid path
**>0 File(s) copied
**>Invalid path
**>0 File(s) copied
C:\Documents and settings\HP_Administrator\Cookies\index.dat
Access denied
0 File(s) copied
0 File(s) copied
0 File(s) copied
0 File(s) copied

C:\Documents and Settings\HP_Administrator>

Have a good day,
RScotti

remove "nospam" in order to email me.

This syntax is fine:
xcopy "SourceDir" "DestDir\"
The trailing backslash for the destination directory means
that xcopy will create DestDir unless it already exists.

This syntax is also OK:
xcopy "SourceDir\*.*" "DestDir\"

This syntax is not OK (as Nepatsfan mentioned):
xcopy "SourceDir\" "DestDir\"

Have a good day,
RScotti

remove "nospam" in order to email me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top