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
<> 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 

Yes I can confirm this

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

Simon Sheppard
email: Simon@ "

page last modified: 2011-03-04