Thread: Copy-Item
View Single Post
Old 05-03-2007   #3 (permalink)
JW


 
 

Re: Copy-Item

Well on my system it does. According to the documentation the -force switch
only:

"Allows cmdlet to override restrictions such as renaming existing files as
long as security is not compromised"

Which is in my opinion needed when attributes like 'hidden' etc. are
specified.

The command:

Copy-Item C:\test.txt -Destination C:\test\

happily copies test.txt into the C:\test directory clobbering the exsisting
test.txt already present in C:\test

--
JW


"Keith Hill" wrote:

> "JW" <JW@discussions.microsoft.com> wrote in message
> news:3EAB4623-137F-41AD-A4E1-1576431544D5@microsoft.com...
> > How do I prevent Copy-Item from overwriting an exsisting file

>
> It shouldn't do that by default unless you specify the -force parameter.
>
> --
> Keith
>

My System SpecsSystem Spec