Dos batch file ?

B

Bill Watt

My daughter uses Win 2000. I have a batch file I use with Win98 SE
to backup My Documents from drive 1 to 2 using Xcopy. I have a
shortcut to it on the Desktop. Works well. I want to make one for
her Win 2000 machine. I'll need to change it as the Documents are in
a different folder. Can this be done in Win 2k?

Here's the line:
Xcopy c:\mydocu~1\*.* F:\Savedocs\ /c /e /h /k /y

I'll take the 3 Xcopy files with me in case Win 2k is lacking it.

Would appreciate any information.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/
 
P

Pegasus \(MVP\)

Bill Watt said:
My daughter uses Win 2000. I have a batch file I use with Win98 SE
to backup My Documents from drive 1 to 2 using Xcopy. I have a
shortcut to it on the Desktop. Works well. I want to make one for
her Win 2000 machine. I'll need to change it as the Documents are in
a different folder. Can this be done in Win 2k?

Here's the line:
Xcopy c:\mydocu~1\*.* F:\Savedocs\ /c /e /h /k /y

I'll take the 3 Xcopy files with me in case Win 2k is lacking it.

Would appreciate any information.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/

Your command will work nicely under Win2000. I recommend
you code it like so:

xcopy "%UserProfile%\*.*" F:\Savedocs\ /c /e /h /k /y

or even better:


xcopy "%UserProfile%\My Documents\*.*" F:\Savedocs\ /c /e /h /k /y

I recommend you add the /d switch to avoid copying the same
files time and again, even though they have not changed.

Do NOT import any commands from Win98. At best they
won't work; at worst they behave unpredictably.
 
B

Bill Watt

Your command will work nicely under Win2000. I recommend
you code it like so:

xcopy "%UserProfile%\*.*" F:\Savedocs\ /c /e /h /k /y

or even better:


xcopy "%UserProfile%\My Documents\*.*" F:\Savedocs\ /c /e /h /k /y

I recommend you add the /d switch to avoid copying the same
files time and again, even though they have not changed.

Do NOT import any commands from Win98. At best they
won't work; at worst they behave unpredictably.

Thanks for the information, just what I was hoping for.
I'll do the same for their pictures wherever they are. :)

Thanks again,

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/
 
B

Bill Watt

Reply at end

Your command will work nicely under Win2000. I recommend
you code it like so:

xcopy "%UserProfile%\*.*" F:\Savedocs\ /c /e /h /k /y

or even better:


xcopy "%UserProfile%\My Documents\*.*" F:\Savedocs\ /c /e /h /k /y

I recommend you add the /d switch to avoid copying the same
files time and again, even though they have not changed.

Do NOT import any commands from Win98. At best they
won't work; at worst they behave unpredictably.

I finally got to my Daughter's house and tried it.
Xcopy c:\"%UserProfile%\*.*" E:\Savedocs\ /c /e /h /k /y /d

I get a message that Windows does not recognize it as a batch file.
I tried other lines using Dos short names for the path to My
Documents, same thing. I also tried long filenames with quotes and
same thing.

If I go to CMD prompt and enter the line I get an error with the
Savedocs folder (unknown). I had created that folder on the backup
drive, E:

If I go to CMD prompt and change to the My Documents folder then
Xcopy to E:\Savedocs\ /c /e /h /k /y /d it works.

I tried doing that in the batch file but it didn't work.

No matter what I do the BAT file is not recognized.

The documents are in the
C:\ Documents and Settings\User\Mike\My Documents folder.
( I think I have that right. )

I didn't create the shortcut to the file and mark it to close on
exit, maybe that would have helped.

Any ideas?

I also had an issue with Scandisk. I'll post a new message for that.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/
 
P

Pegasus \(MVP\)

See below.

Bill Watt said:
Reply at end



I finally got to my Daughter's house and tried it.
Xcopy c:\"%UserProfile%\*.*" E:\Savedocs\ /c /e /h /k /y /d

I'm afraid you took some liberties here:
xcopy "%UserProfile%\*.*" (this is what I wrote)
Xcopy c:\"%UserProfile%\*.*" (this is what you wrote)

I'm sure you can see the difference.
I get a message that Windows does not recognize it as a batch file.

I assume you placed your command into a batch file. What
is the name of the batch file? Where does it reside? How did
you invoke it?
I tried other lines using Dos short names for the path to My
Documents, same thing. I also tried long filenames with quotes and
same thing.

If I go to CMD prompt and enter the line I get an error with the
Savedocs folder (unknown). I had created that folder on the backup
drive, E:

This is probably because of the liberties you took.
If I go to CMD prompt and change to the My Documents folder then
Xcopy to E:\Savedocs\ /c /e /h /k /y /d it works.

Of course it does, because you now walk around the
incorrect coding.
 
B

Bill Watt

On Thu, 27 Apr 2006 15:54:21 +1000, "Pegasus \(MVP\)"

SNIP
I'm afraid you took some liberties here:
xcopy "%UserProfile%\*.*" (this is what I wrote)
Xcopy c:\"%UserProfile%\*.*" (this is what you wrote)

I'm sure you can see the difference.

I added C:\ because I have an exact copy of C: on E:. I'll change
it.
I assume you placed your command into a batch file. What
is the name of the batch file? Where does it reside? How did
you invoke it?

I put the line in a Savedocs.bat file and put it in the root (C:\)
along with the 3 Xcopy files. I've d-clicked it from Windows
Explorer and also ran it from the CMD prompt. I'll rename the file,
it's the same name as the folder on E:

The %UserProfile% statement, is that an environment variable???
Could you explain that?

Can long file names and DOS short filenames be used in a batch file
and the CMD prompt?

SNIP

Thanks for the help. I'll probably get to try it on Monday.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/
 
P

Pegasus \(MVP\)

Bill Watt said:
On Thu, 27 Apr 2006 15:54:21 +1000, "Pegasus \(MVP\)"

SNIP


I added C:\ because I have an exact copy of C: on E:. I'll change
it.


I put the line in a Savedocs.bat file and put it in the root (C:\)
along with the 3 Xcopy files. I've d-clicked it from Windows
Explorer and also ran it from the CMD prompt. I'll rename the file,
it's the same name as the folder on E:

The %UserProfile% statement, is that an environment variable???
Could you explain that?

Can long file names and DOS short filenames be used in a batch file
and the CMD prompt?

SNIP

Thanks for the help. I'll probably get to try it on Monday.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/

Environmental variables have not really changed since the old
DOS/Win98 days. They are invariably referenced with surrounding
% characters, e.g. %UserName%, %ComputerName%. To see
the full collection, type set {Enter} at the Command Prompt.

When you changed %UserProfile% to c:\%UserProfile%, you
effectively changed
c:\Documents and Settings to
c:\c:\Documents and Settings
which is obviously nonsense. I recommend you check all
your variables before you embed them in a batch file. The
command echo %UserProfile% will do it nicely.
 
B

Bill Watt

Reply at end

Environmental variables have not really changed since the old
DOS/Win98 days. They are invariably referenced with surrounding
% characters, e.g. %UserName%, %ComputerName%. To see
the full collection, type set {Enter} at the Command Prompt.

When you changed %UserProfile% to c:\%UserProfile%, you
effectively changed
c:\Documents and Settings to
c:\c:\Documents and Settings
which is obviously nonsense. I recommend you check all
your variables before you embed them in a batch file. The
command echo %UserProfile% will do it nicely.

Finally got an error "incorrect Dos version". Removed the 3 Xcopy
files I had copied from my machine and it worked fine. Created a
shortcut to the bat file on the Desktop. Did the same for their
pictures. They use it for business and they keep contracts in My
Documents and pictures of houses in another folder.

Thanks again.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/
 
P

Pegasus \(MVP\)

Bill Watt said:
Reply at end



Finally got an error "incorrect Dos version". Removed the 3 Xcopy
files I had copied from my machine and it worked fine. Created a
shortcut to the bat file on the Desktop. Did the same for their
pictures. They use it for business and they keep contracts in My
Documents and pictures of houses in another folder.

Thanks again.

Regards,

Bill Watt
Win98 Computer Help & Other Information http://home.ptd.net/~bwatt/

Thanks for the feedback. In general each OS has its
own native tools - using the same tools from an other
OS is risky.
 

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