Relative Path Search Point in powershell

I am trying to figure out how to use relative paths for Powershell scripts. I have a point with absolute paths, but the scripts I write may be in a different base directory, so I need to make sure that the path is relative so that it can be picked up. How can i do this?

So far I have tried:

. .\scripts\variables.ps1

This always raises this exception:

The term '.\scripts\variables.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program...

What lets me know that it cannot find my script? So what am I doing wrong?

+4
source share
1 answer

, . . , ? ps1? PowerShell ISE F8 F5? , $ PSScriptroot .. , , , , $ (Resolve-Path..) $ myinvocation.mycommand.path.

0

Source: https://habr.com/ru/post/1544362/


All Articles