Plymouth223
Plymouth223

Reputation: 1925

How do you provide defaults to powershell scripts

I have a script such as the following:

param([parameter(mandatory=$true)][string]$sourceFolder)

write-host $sourceFolder

How do I provide a default value for the $sourceFolder parameter such that the parameter becomes optional?

Upvotes: 0

Views: 68

Answers (1)

Plymouth223
Plymouth223

Reputation: 1925

DOH! Just figured it out....

param([string]$sourceFolder = "1234")

Upvotes: 1

Related Questions