Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PowerShell命令行导入模块_Powershell_Powershell 2.0 - Fatal编程技术网

PowerShell命令行导入模块

PowerShell命令行导入模块,powershell,powershell-2.0,Powershell,Powershell 2.0,我在模块M1下有一个cmdlet。我需要从命令行本身运行cmdlet。比如说,powershell-Command cmdlet1 但我需要在运行cmdlet1之前导入模块M1。有没有一种方法可以让我一次性完成 我不想与PowerShell交互,但我想像运行普通Windows命令一样运行cmdlet1。尝试: powershell -command "& { import-module M1; cmdlet1 }" 或者只是: powershell -command "import

我在模块M1下有一个cmdlet。我需要从命令行本身运行cmdlet。比如说,
powershell-Command cmdlet1

但我需要在运行
cmdlet1
之前导入模块M1。有没有一种方法可以让我一次性完成

我不想与PowerShell交互,但我想像运行普通Windows命令一样运行
cmdlet1

尝试:

 powershell -command "& { import-module M1; cmdlet1 }"
或者只是:

 powershell -command "import-module M1; cmdlet1 "
尝试:

或者只是:

 powershell -command "import-module M1; cmdlet1 "