Wszystkie odpowiedzi, których szukasz, znajdują się w plikach pomocy programu PowerShell.
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
(Get-Command -Name Get-ChildItem).Parameters
Get-help -Name Get-ChildItem -Examples
Get-help -Name Get-ChildItem -Full
Get-help -Name Get-ChildItem -Online
(Get-Command -Name ForEach).Parameters
Get-help -Name ForEach -Examples
Get-help -Name ForEach -Full
Get-help -Name ForEach -Online
(Get-Command -Name Copy-Item).Parameters
Get-help -Name Copy-Item -Examples
Get-help -Name Copy-Item -Full
Get-help -Name Copy-Item -Online
# Get parameter that accept pipeline input
Get-Help Get-ChildItem -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
Get-Help about_*
Get-Help about_Functions
Lub po prostu użyj wbudowanej robocopy, aby skopiować źródło do miejsca docelowego.
robocopy <Source> <Destination> [<File>[ ...]] [<Options>]
Spójrz na opcje przełączników / COPY: [copyflags] i / DCOPY.
# As per the ROBOCOPY /? usage info:
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:T :: COPY Directory Timestamps.
# For example:
ROBOCOPY c:\src d:\dest /MIR /COPY:DT /DCOPY:T
# Will copy all files and folders and preserve the date and time stamps.
ROBOCOPY c:\src d:\dest /MIR /COPY:DAT /DCOPY:T
Will copy all files and folders and preserve the date & time stamps and file attributes.
There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.