What is $PSScriptRoot in PowerShell?

Adarsh Vijayakumar
Adarsh Vijayakumar

Posted On: Feb 22, 2018

 

    1 Answer Written

  •  Adarsh Vijayakumar
    Answered by Kanak

    $PSScriptRoot in PowerShell

    Powershell or Windows shell is a command-line used in a scripting language. It helps in the automation of different daily tasks related to the automation, writing data into Excel, notepad, word, ppt etc, system monitoring and backup for domains. $PSScriptRoot is a variable used inside the PowerShell of Windows for the script modules. In terms of PowerShell 2.0, it is valid for only some script modules while in the case of PowerShell 3.0 it is valid for all scripts. The $null is an automatic variable of $PSScriptRoot if used outside from the code file of PowerShell. In case if the use of $PSScriptRoot is inside the PowerShell then it can define the fully qualified path of the file system in the scripted file's Directory.

Related Questions

Please Login or Register to leave a response.

Related Questions

PowerShell Interview Questions

What is PowerShell?

PowerShell is a command-line tool built upon the .NET framework to help the windows system administrator. With PowerShell, you can control your system operations such as accessing data storage, regist...

PowerShell Interview Questions

How to run a PowerShell script?

To run a script in the PowerShell, go to the directory where your script is stored on your PowerShell command. Then, run the script by typing the following command. PS C:\script_folder> ./Script.p...

PowerShell Interview Questions

How to check powershell version in Windows?

Open your PowerShell command and type the following command to find the version, PS C:\> $PSVersionTable.PSVersion The major column value of the result is the version of your PowerShell....