Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - -container in Copy-Item

Reply
 
Old 02-16-2008   #1 (permalink)
hugh


 
 

-container in Copy-Item

Hi all

I am trying to find out what are the possible values for -container


like in Copy-Item .... -container WHAT?

What are the possible values for what comes after -container? Help says
its a "switch" .... and that means that the possible values are?

perhaps -container ON or container OFF ?

or -container Y or N ?

1 or 0 ?

T or F ?

Technet does not anything more than help on this -container

Thanks for your help

My System SpecsSystem Spec
Old 02-16-2008   #2 (permalink)
Shay Levi


 
 

Re: -container in Copy-Item

It's a SwitchParameter. A SwitchParameter takes boolean values.
Generally, when you specify a SwitchParameter it's equal to $true otherwise
it's $false. As you can see below, $true is the default.


PS > help Copy-Item -full

(...)
-container <SwitchParameter>
Preserves container objects during the copy operation.

Required? false
Position? named
Default value True
Accept pipeline input? false
Accept wildcard characters? false



You can also specify it like so (disable):

Copy-Item -container:$false



-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Hi all
>
> I am trying to find out what are the possible values for -container
>
> like in Copy-Item .... -container WHAT?
>
> What are the possible values for what comes after -container? Help
> says its a "switch" .... and that means that the possible values are?
>
> perhaps -container ON or container OFF ?
>
> or -container Y or N ?
>
> 1 or 0 ?
>
> T or F ?
>
> Technet does not anything more than help on this -container
>
> Thanks for your help
>

My System SpecsSystem Spec
Old 02-17-2008   #3 (permalink)
Jon


 
 

Re: -container in Copy-Item

You usually use switches with nothing after them, as this short function
illustrates ....

function switchtest {
param([switch]$MySwitch)
Write-Host $MySwitch
}


#Output......

PS (2) > switchtest
False
PS (3) > switchtest -myswitch
True
PS (4) >

--
Jon


"hugh" <hugh@xxxxxx> wrote in message news:fp6uh5$9aj$1@xxxxxx
Quote:

> Hi all
>
> I am trying to find out what are the possible values for -container
>
>
> like in Copy-Item .... -container WHAT?
>
> What are the possible values for what comes after -container? Help says
> its a "switch" .... and that means that the possible values are?
>
> perhaps -container ON or container OFF ?
>
> or -container Y or N ?
>
> 1 or 0 ?
>
> T or F ?
>
> Technet does not anything more than help on this -container
>
> Thanks for your help
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Copy-Item : Container cannot be copied onto existing leaf item. PowerShell
Can the copy-item cmdlet be used to copy public folders to C: ? PowerShell
copy-item changing files attributes on network copy failures PowerShell
Copy-Item not honoring -container PowerShell
Copy-Item not honoring -container PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46