In PowerShell, how do I define a function in a file and call it from the PowerShell commandline?

前端 未结 7 1359
悲&欢浪女
悲&欢浪女 2020-12-12 08:29

I have a .ps1 file in which I want to define custom functions.

Imagine the file is called MyFunctions.ps1, and the content is as follows:

Write-Host          


        
相关标签:
7条回答
  • 2020-12-12 09:21

    Try this on the PowerShell command line:

    . .\MyFunctions.ps1
    A1
    

    The dot operator is used for script include.

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