December 2013
Intermediate to advanced
1872 pages
153h 31m
English
Several of the core PowerShell cmdlets support –whatif and/or –confirm parameters. The cmdlets that support these parameters could actually make system changes that cannot be reserved, such as deleting a file.
Consider the following example using these parameters:
PS>New-Item -Type File -Path file.tmp Directory: Microsoft.PowerShell.Core\FileSystem::C:\bookMode LastWriteTime Length Name---- -------------- ------ -----a--- 8/4/2008 10:33 PM 0 file.tmpPS>Remove-Item -Path file.tmp -WhatIfWhat if: Performing operation "Remove File" on Target"C:\book\file.tmp".PS>
Two new cmdlets are demonstrated in the preceding example: New-Item ...