What is $PSScriptRoot in PowerShell?
$PSScriptRoot is an Automatic Variable, which are built-in variables that comprise records about the PowerShell surroundings itself. $PSScriptRoot includes the listing direction of the script being done currently.
Originally $PSScriptRoot used to be solely relevant to script modules, however commencing with PowerShell 3.0, it works for all PowerShell script files. From the console, if I kind $PSScriptRoot and press ENTER, it returns nothing.
BY Best Interview Question ON 22 Apr 2020