Let's say I have a .ps1 with this content (the actual content does not matter) :
param( [Parameter(Mandatory=$true)] [string] $someArgument ) # Do something risky Remove-Item "c:\path\$someArgument.txt"
I'd like to add to my script (or to any method in fact) a confirmation message, that can be switch off (on by default).
.\myscript.ps1 "foo" -Confirm:$false
How can I do that ?