relative path in Import-Module

前端 未结 3 962
野趣味
野趣味 2020-12-29 18:46

I have directory structure that looks like this:

C:\\TFS\\MasterScript\\Script1.ps1
C:\\TFS\\ChildScript\\Script2.ps1

What i want to do is

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 19:31

    The new Method for this is $PSScriptRoot

    Import-Module $PSScriptRoot\Script1.ps1
    

    Nice little one liner.

提交回复
热议问题