[英]I want to load modules from a relative path so that it will work when script is run from the a cmd prompt, inside the PowerShell Repl and ISE
[英]load 2 modules when launching powershell from cmd?
我想要一个启动PowerShell并导入两个模块的衬垫。 要加载一个模块,此行有效:
powershell -command import-module 'c:\module1'
但是如何加载两个模块? 或 - 打开电源外壳时如何运行两个命令?
Import-Module cmdlet采用字符串数组,因此您可以用逗号分隔要导入的模块(这将隐式创建字符串数组):
powershell -command import-module 'c:\module1', 'c:\module2'
或者,您可以显式创建字符串数组并将其传递给Import-Module
cmdlet:
powershell -command import-module @('c:\module1', 'c:\module2')
对于你的第二个问题,我建议你阅读about_Profiles 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.