Need help on Bat file

R

RScotti

Hi,
I am trying to reverse the following Bat file but for some reason I am doing something wrong.
Could you please show me my mistake?
I can't seem to recognize it.

It works this way:

@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\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:\CBackup\"



But not this way:

@echo off
rem xcopy /s /y /d /h /c "J:\Agent\" "C:\Program Files\Agent"
xcopy /s /y /d /h /c "J:\Agent\" "C:\Documents and settings\HP_Administrator\My Documents\Agent\"
xcopy /s /y /d /h /c "J:\Cookies\" "C:\Documents and settings\HP_Administrator\Cookies"
xcopy /s /y /d /h /c "J:\Favorites\" "C:\Documents and settings\HP_Administrator\Favorites"
xcopy /s /y /d /h /c "J:\Backup\" "C:\Documents and settings\HP_Administrator\My Documents\Backup"
xcopy /s /y /d /h /c "J:\CBackup\" "C:\Documents and settings\HP_Administrator\My Documents\CBackup"

This is all I get:

C:\Documents and Settings\HP_Administrator>r
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied

Once in a great while the source where I am executing it from turns to the old DOS 8/3 format at the end of the failed
run.
My external source drive is on and can see the files.


Have a good day!

RScotti
 
M

Marcin Domaslawski

Hi,

Remove backslashes from target dirs:

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


Marcin Domaslawski
 
P

Pegasus \(MVP\)

RScotti said:
Hi,
I am trying to reverse the following Bat file but for some reason I am doing something wrong.
Could you please show me my mistake?
I can't seem to recognize it.

It works this way:

@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\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:\CBackup\"
But not this way:

@echo off
rem xcopy /s /y /d /h /c "J:\Agent\" "C:\Program Files\Agent"
xcopy /s /y /d /h /c "J:\Agent\" "C:\Documents and
settings\HP_Administrator\My Documents\Agent\"
xcopy /s /y /d /h /c "J:\Cookies\" "C:\Documents and settings\HP_Administrator\Cookies"
xcopy /s /y /d /h /c "J:\Favorites\" "C:\Documents and settings\HP_Administrator\Favorites"
xcopy /s /y /d /h /c "J:\Backup\" "C:\Documents and
settings\HP_Administrator\My Documents\Backup"
xcopy /s /y /d /h /c "J:\CBackup\" "C:\Documents and
settings\HP_Administrator\My Documents\CBackup"
This is all I get:

C:\Documents and Settings\HP_Administrator>r
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied
Invalid path
0 File(s) copied

Once in a great while the source where I am executing it from turns to the
old DOS 8/3 format at the end of the failed
run.
My external source drive is on and can see the files.


Have a good day!

RScotti

There are several ways of using trailing backslashes:

a) xcopy /s /y /d /h /c "J:\Agent" "C:\Program Files\Agent"
This is OK. However, you will get a prompt if the target
directory does not exist.

b) xcopy /s /y /d /h /c "J:\Agent\*.*" "C:\Program Files\Agent"
Same as a).

c) xcopy /s /y /d /h /c "J:\Agent" "C:\Program Files\Agent\"
This is the preferred solution. If the target directory does
not exist then it will be created.

d) xcopy /s /y /d /h /c "J:\Agent\" "C:\Program Files\Agent\"
This won't work.
 
P

Pegasus \(MVP\)

You probably meant "Remove the backslashes from
the ***source*** directories.
 
R

RScotti

Hi Marcin,
Thank you very much I really missed that one.

For the most part it worked except near the end. I got this:

Insufficient memory
2144 File(s) copied
Does C:\Documents and settings\HP_Administrator\My Documents\CBackup
specify a file name or directory name on the target
(F = file, D = directory)?

When I hit the D it did copy all the rest of the files.

I just don't understand the Insufficient memory? I have 2 GB of ram.

Hi,

Remove backslashes from target dirs:

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


Marcin Domaslawski

Have a good day!

RScotti
 
P

Pegasus \(MVP\)

"Insufficient memory" is a known bug when xcopy.exe processes
large numbers of files. Use xxcopy.exe instead (downloadable
from a number of sites) or robocopy.exe (Windows Resource
Kit).


RScotti said:
Hi Marcin,
Thank you very much I really missed that one.

For the most part it worked except near the end. I got this:

Insufficient memory
2144 File(s) copied
Does C:\Documents and settings\HP_Administrator\My Documents\CBackup
specify a file name or directory name on the target
(F = file, D = directory)?

When I hit the D it did copy all the rest of the files.

I just don't understand the Insufficient memory? I have 2 GB of ram.
 
M

Marcin Domaslawski

Yap, mind is much faster then fingers and keyboard - when I was writing it I
already had to be somewhere else ;-)

Marcin Domaslawski
 
R

RScotti

Thanks Pegasus,
Thanks for your help again. You really come to the rescue.
I changed it to the preferred way.
c) xcopy /s /y /d /h /c "J:\Agent" "C:\Program Files\Agent\"
This is the preferred solution. If the target directory does
not exist then it will be created.

I also D/L'd the xxcopy.exe. When I use this I put it in the folder I am using to execute the file from, Right?


settings\HP_Administrator\My Documents\Agent\"
settings\HP_Administrator\Favorites" "J:\Favorites\"
Documents\Backup" "J:\CBackup\"
settings\HP_Administrator\My Documents\Agent\"
settings\HP_Administrator\My Documents\Backup"
settings\HP_Administrator\My Documents\CBackup"
old DOS 8/3 format at the end of the failed

There are several ways of using trailing backslashes:

a) xcopy /s /y /d /h /c "J:\Agent" "C:\Program Files\Agent"
This is OK. However, you will get a prompt if the target
directory does not exist.

b) xcopy /s /y /d /h /c "J:\Agent\*.*" "C:\Program Files\Agent"
Same as a).

c) xcopy /s /y /d /h /c "J:\Agent" "C:\Program Files\Agent\"
This is the preferred solution. If the target directory does
not exist then it will be created.

d) xcopy /s /y /d /h /c "J:\Agent\" "C:\Program Files\Agent\"
This won't work.

Have a good day!

RScotti
 
G

Guest

Put xxcopy.exe into your c:\windows\system32 or c:\winnt\system32 directory.
Those directories are always in your path, and then the program will run from
anywhere.

MD
 
R

RScotti

Hi,
I got confused. The read me said something about running install.bat so I did. it did put xxcopy in the
C:\windows\system32.
So now all I have to do is change my strings from:

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

to:
xxcopy /s /y /d /h /c "C:\Documents and settings\HP_Administrator\My Documents\Backup" "J:\CBackup\"

Is that the way to do it?

Put xxcopy.exe into your c:\windows\system32 or c:\winnt\system32 directory.
Those directories are always in your path, and then the program will run from
anywhere.

MD

Have a good day!

RScotti
 

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