You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-Wait
Expected 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
The text was updated successfully, but these errors were encountered:
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:
Expected result:
Actual result:
Environment
The text was updated successfully, but these errors were encountered: