【发布时间】:2016-12-16 14:41:50
【问题描述】:
假设我有一个脚本:
write-host "Message.Status: Test Message Status";
我设法在一个单独的进程中运行它:
powershell.exe -Command
{ write-host "Message.Status: Test Message Status"; }
问题是我想将参数传递给脚本,这样我就可以实现这样的目标:
write-host "I am in main process"
powershell.exe -Command -ArgumentList "I","am","here"
{
write-host "I am in another process"
write-host "Message.Status: $($one) $($two) $($three)";
}
但是-ArgumentList 在这里不起作用
我明白了:
powershell.exe : -ArgumentList : The term '-ArgumentList' is not recognized as the name of a cmdlet, function, script file, or operable
我需要在不同的进程中运行 PowerShell 脚本文件的某些部分,由于 PowerShell 脚本已上传到外部系统,我无法使用其他文件。
【问题讨论】:
标签: windows powershell process