小编Pla*_*zma的帖子

profile.ps1 如何导入脚本和函数

我有一些自己制作的函数和脚本。问题是我不确定保存在哪里以及如何加载。

在本地配置文件上,我有以下内容:C:\Users\Plazma\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

有了这个:

Import-Module c:\Users\Plazma\Documents\WindowsPowerShell\Get-serialnumber.ps1 -Force
Import-Module c:\Users\Plazma\Documents\WindowsPowerShell\Invoke-AutoIPAssigning.ps1 -Force
Import-Module C:\Users\Plazma\Documents\WindowsPowerShell\Reset-Password.ps1 -Force
Import-Module C:\Users\Plazma\Documents\WindowsPowerShell\Send-Email.ps1 -Force
Run Code Online (Sandbox Code Playgroud)

在这些文件中,我有函数/脚本。这是一个很好的做法,或者我应该以其他方式导入它?使用 ForEach 加载该位置的所有文件?如果一个功能将使用另一个功能(例如总是在重置密码后我想发送电子邮件)我应该如何导入它?

powershell

6
推荐指数
1
解决办法
2391
查看次数

标签 统计

powershell ×1