Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
psake - passing in parameters
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
Get-Module psake | Remove-Module
Import-Module ("C:\Dev\Tools\psake.4.6.0\tools\psake.psm1")
$envProperties = @{
"starterParam1"="start param value"
"starterParam2"=
"start param 2 value", `
"sadkjsahd", `
"item3"
}
invoke-psake $scriptDir\tasks.ps1 -properties $envProperties
properties {
$localTaskValue = " -- local -- "
$starterParam1 = $null
$starterParam2 = $null
}
task default -Depends Task1
task Task1 {
"..discovered parameters.."
Write-Host $psake.context.Peek().properties
"..individual params.."
Write-Host "starterParam1: $starterParam1"
Write-Host "starterParam2: $starterParam2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.