gpt4 book ai didi

java - Powershell启动进程Java PassThru

转载 作者:太空宇宙 更新时间:2023-11-04 12:32:14 28 4
gpt4 key购买 nike

Windows Power shell 启动后无法获取 java 进程详细信息。它适用于“记事本”,但不适用于 java。

工作记事本cmd:

  PS > $apmax=Start-Process notepad "abc.txt" -PassThru

java失败:

PS > $apmax=Start-Process java "-jar ApMaxProvMngr-1.0.jar" -PassThru
Start-Process : This command cannot be run completely because the system cannot find all the information
required.
At line:1 char:8
+ $apmax=Start-Process java "-jar ApMaxProvMngr-1.0.jar" -PassThru
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

我在这里错过了什么吗?

最佳答案

  1. 使用显式“ArgumentList”参数(请参阅 docs);
  2. 分别传递多个参数。

    $apmax=Start-Process java -ArgumentList '-jar','ApMaxProvMngr-1.0.jar' -PassThru

关于java - Powershell启动进程Java PassThru,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37736695/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com