Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 354 Bytes

default_parameter_values.md

File metadata and controls

17 lines (12 loc) · 354 Bytes

How to do default parameter values in Powershell

You have to give a formal declaration of the function's parameter.

function Test {
	Param (
		[ValidateNotNullOrEmpty()]
		[String]
		$String = 'DEFAULT'
	)

	Write-Host -Object "String: $String"
}

See also