官术网_书友最值得收藏!

Functions

Functions are similar to cmdlets and should follow the same naming conventions. Whereas cmdlets are compiled units of PowerShell functionality written in managed code like C#, functions are written using the PowerShell language. Starting with PowerShell 2.0, it has been possible to write advanced functions, which are very similar to cmdlets. It is possible to use common parameters and risk mitigation parameters with advanced functions. An example of a function is shown as follows:

function get-PowerShellVersionMessage{
param($name)
    $PowerShellVersion=$PSVersionTable.PSVersion
    return "We're using $PowerShellVersion, $name!"
}

Calling the function at the command line is straightforward, as shown in the following screenshot:

主站蜘蛛池模板: 图木舒克市| 本溪市| 温州市| 赫章县| 冕宁县| 泗洪县| 藁城市| 金溪县| 文水县| 祥云县| 饶河县| 勐海县| 博湖县| 呼伦贝尔市| 白沙| 罗山县| 乐昌市| 永宁县| 柳林县| 花莲市| 天祝| 双江| 天台县| 利津县| 洪泽县| 绍兴市| 蕲春县| 泗阳县| 武邑县| 康平县| 永善县| 年辖:市辖区| SHOW| 克拉玛依市| 商南县| 临高县| 洮南市| 柘城县| 东乌珠穆沁旗| 永年县| 华池县|