I read widely that I can pass an argument to my powershell script through:
param ( [Datetime]$argument )
I also read that I can determine the default value:
param ( [Datetime]$argument = Get-Date "5/1/2006 7:00 AM" )
However, with this I get:
In C: \ Users \ medmondson \ Desktop \ Scripts \ ScrumTimer.ps1: 2 char: 26 + [Datetime] $ argument = Get-Date "5/1/2006 7:00 AM" + ~ Missing expression after '='. In C: \ Users \ medmondson \ Desktop \ Scripts \ ScrumTimer.ps1: 2 char: 24 + [Datetime] $ argument = Get-Date "5/1/2006 7:00 AM" + ~ Missing ')' in the parameter list functions. In C: \ Users \ medmondson \ Desktop \ Scripts \ ScrumTimer.ps1: 3 char: 1 +) + ~ Unexpected token ')' in the expression or expression. + CategoryInfo: ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId: MissingExpressionAfterToken
It only seems to be for DateTime , any idea I'm wrong in?
source share