PSScriptRoot in ps1 script in PSv3 is empty in ISE - by J Stangroome

Status : 


Sign in
to vote
ID 769359 Comments
Status Active Workarounds
Type Bug Repros 6
Opened 10/31/2012 1:56:02 PM
Access Restriction Public


In the PSv3 documentation, $PSScriptRoot is now an automatic variable that is populated for both modules and ps1 scripts. It works from PowerShell.exe but not from the ISE
Sign in to post a comment.
Posted by Michael Naumov on 10/31/2012 at 4:32 PM
Interesting bug.

I could reproduce it

However even in that situation

$myVar = $PSScriptRoot

works as expected and the correct value is set to $myVar