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

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

    You can add function to:

    c:\Users\David\Documents\WindowsPowerShell\profile.ps1
    

    An the function will be available.

提交回复
热议问题