Steps to reproduce
Run this script (via PowerShell -File ....)
param(
[Parameter(Mandatory = $false)]
[string] $Foo = 'hi\{0}\hi' -f $PSScriptRoot
)
Write-Host $Foo
Function Bar {
param(
[Parameter(Mandatory = $false)]
[string] $Bar = $PSScriptRoot
)
Write-Host $Bar
}
Function Baz {
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[string] $Baz = $PSScriptRoot
)
Write-Host $Baz
}
Bar
Baz
Expected behavior
hi\C:\tmp\hi
C:\tmp
C:\tmp
Actual behavior
Environment data
Name Value
---- -----
PSVersion 5.1.16353.1000
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16353.1000
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
[edited by @daxian-dbw to put the repro in code blocks]
Steps to reproduce
Run this script (via PowerShell -File ....)
Expected behavior
Actual behavior
Environment data
[edited by @daxian-dbw to put the repro in code blocks]