首页 > 系统服务 > 详细

PowerShell 自动载人函数

时间:2015-01-10 00:55:37      阅读:561      评论:0      收藏:0      [点我收藏+]

法一:新建 %userprofile%\Documents\WindowsPowerShell\profile.ps1 就能让PowerShell 自动载人其中定义的内容。

法二:将.ps1文件改成.psm1文件,将其放在%userprofile%\Documents\WindowsPowerShell\Modules下,注意要为每个psm1文件件建一个同名的文件夹,然后将psm1文件放在这个文件夹中

Get-Module –listavailable        测试看能不能检测到新建的模块
Get-Command -module MyFunctions        获取对应的模块中的函数,很有用

来源:http://stackoverflow.com/questions/6016436/in-powershell-how-do-i-define-a-function-in-a-file-and-call-it-from-the-powersh

           http://msdn.microsoft.com/en-us/library/bb613488%28VS.85,loband%29.aspx

PowerShell 自动载人函数

原文:http://www.cnblogs.com/cnsealine/p/4214365.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!