Rob van der Woude's Scripting Pages

Solutions found in alt.msdos.batch

and alt.msdos.batch.nt

XCOPY overwrite defaults

Here's an interesting tip from Simon Sheppard for those scripts that need to XCOPY files in both Windows NT 4 and 2000:

From: simon@spam.invalid (Simon Sheppard)
Newsgroups: alt.msdos.batch.nt
Subject: Re: XCOPY in batch NT4/Win2000

On Wed, 1 Aug 2001 10:26:19 -0400, Rick Charnes
<rick.charnes@thehartford.com> wrote:

>I've just heard that under Win2k XCOPY defaults to 'prompt to overwrite 
>each file' and a /Y switch will suppress prompting, whereas under NT4 it 
>defaults to 'automatically overwrite each file' and /Y is not a valid 
>switch.  Boy, does this complicate batch files that need to run under 
>both OS's.  Can anyone confirm this?  Any tips for dealing with this 
>problem?

Yes I can confirm this

The workaround is to use the COPYCMD env variable 
set COPYCMD=/Y
This will turn off the prompt in Win2000 and will be ignored by NT4

http://www.ss64.com/nt/xcopy.html

-
Simon Sheppard
Web: http://www.ss64.com
email: Simon@ "

page last modified: 2011-03-04; loaded in 0.0075 seconds