Know the name of the directory where I run a powershell script?

1

How to know the name of the directory in which I run a powershell script ?, my code is as follows:

$usuario = $env:USERPROFILE

[Reflection.Assembly]::LoadFile("$usuario\Desktop\"nombre de la carpeta"\lib.dll")

I want to put a variable in the "name of the folder" that I take the name of the current folder where I run the script as it would be! I have looked at the environment variables but I can not find any that serve me.

    
asked by ortiga 21.06.2018 в 19:34
source

1 answer

1

Use the automatic variable:

$PSScriptRoot

Inside a file .ps1 will return the path from where the file .ps1

is located     
answered by 21.06.2018 / 22:27
source