Loading custom functions in PowerShell

后端 未结 2 1174
陌清茗
陌清茗 2020-12-24 00:55

I\'ve got some additional functions that I\'ve defined in an additional PowerShell script file, that I\'m trying to load in a main .ps1 file. However, when I call the .ps1 f

相关标签:
2条回答
  • 2020-12-24 01:25

    I kept using this all this time

    Import-module .\build_functions.ps1 -Force
    
    0 讨论(0)
  • 2020-12-24 01:32

    You have to dot source them:

    . .\build_funtions.ps1
    . .\build_builddefs.ps1
    

    Note the extra .

    This heyscriptingguy article should be of help - How to Reuse Windows PowerShell Functions in Scripts

    0 讨论(0)
提交回复
热议问题