How it works...
PowerShell is capable of making changes to your system in such a drastic way that sometimes it is simply scary—this is no different than any other shell, such as Bash. Therefore, there are two very important functionalities built into PowerShell that help ensure that you do not accidentally do what you did not intend to.
The first among these capabilities is the ShouldContinue capability, or the Confirm parameter. As the name suggests, it asks you whether the operation should continue. In order to ask this, though, it needs some information that is useful to you. We will get to that in a moment.
The first change compared to 06-New-File.ps1, as you may have noticed, is the [CmdletBinding()] line, right before the parameter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access