我有一个脚本,它应该复制另一个脚本并运行模块,但是当我多次尝试运行它时,它就会在没有警告的情况下结束,没有输出/错误。
我一直在努力导入模块,以帮助我的脚本运行得更好,同时也简化了使用。
$Script:Es = $PSScriptRoot + "\" + "Main Script.psm1"
$Script:Ma32 = "C:\Temp\Scripts2"
$Script:E2 = "\Main Script.psm1"
$Script:E3 = $Ma32 + $E2
Function Get-Check {
if ( -Not (Test-Path -Path $Ma32 ) ) {
New-Item -ItemType directory -Path $Ma32 |out-null
}
}
Function Get-Run {
copy-item $Es $Ma32
Import-Module $E3
}
Function St {
Get-Check
Get-Run
}
St发布于 2019-01-25 19:20:28
感谢你的回答,使用-force可以解决这个问题。
Import-Module $E3 -forcehttps://stackoverflow.com/questions/54363075
复制相似问题