1.

What is $PSScriptRoot in PowerShell?

Answer»

$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.



Discussion

No Comment Found