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

前端 未结 7 1397
悲&欢浪女
悲&欢浪女 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:20

    Assuming you have a module file called Dummy-Name.psm1 which has a method called Function-Dumb()

    Import-Module "Dummy-Name.psm1";
    Get-Command -Module "Function-Dumb";
    #
    #
    Function-Dumb;
    

提交回复
热议问题