-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The problem is pretty straightforward: I have a script that uses $PSScriptRoot, but when I ran the script in a ThreadJob, it malfunctioned, because $PSScriptRoot evaluated to an empty string.
Repro steps:
echo 'Write-Host "PSScriptRoot is: $PSScriptRoot"' > ReproThreadJobHasNoScriptRoot.ps1
start-threadjob -FilePath .\ReproThreadJobHasNoScriptRoot.ps1 | Receive-Job -WaitExpected result:
PSScriptRoot is: <it should print out the current directory>
Actual result:
PSScriptRoot is:
Environment
Name Value
---- -----
PSVersion 7.1.0-preview.7
PSEdition Core
GitCommitId 7.1.0-preview.7
OS Microsoft Windows 10.0.20222
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
lewcc
Metadata
Metadata
Assignees
Labels
No labels