基于StackOverflow 上的这个问题,如果可执行文件仅在 1 个实例中运行,我可以使用以下命令更改处理器关联性:
PowerShell "$Process = Get-Process java; $Process.ProcessorAffinity=11"
Run Code Online (Sandbox Code Playgroud)
如果有 2 个或更多实例正在运行,我无法更改,这是输出
C:\PowerShell "$Process = Get-Process java; $Process.ProcessorAffinity=11"
The property 'ProcessorAffinity' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:30
+ $Process = Get-Process java; $Process.ProcessorAffinity=11
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
Run Code Online (Sandbox Code Playgroud)
有谁知道如何使用 Powershell 更改所有 java.exe 实例的处理器关联性?