Jua*_*blo 11 windows batch-file affinity
在Windows中,用
 START /node 1 /affinity ff cmd /C "app.exe"
我可以设置app.exe的亲和力(app.exe使用的核心数).
使用Windows脚本,如何更改正在运行的进程的亲和力?
Dav*_*ann 15
PowerShell "Get-Process app | Select-Object ProcessorAffinity"
PowerShell "$Process = Get-Process app; $Process.ProcessorAffinity=255"
只需将十进制值一起添加到您要使用的核心即可.255 =全部8个核心.
C:\>PowerShell "Get-Process notepad++ | Select-Object ProcessorAffinity"
                                                              ProcessorAffinity
                                                              -----------------
                                                                            255
C:\>PowerShell "$Process = Get-Process notepad++; $Process.ProcessorAffinity=13"
C:\>PowerShell "Get-Process notepad++ | Select-Object ProcessorAffinity"
                                                              ProcessorAffinity
                                                              -----------------
                                                                             13
C:\>PowerShell "$Process = Get-Process notepad++; $Process.ProcessorAffinity=255"
C:\>
资源:
这是一篇关于如何改变流程亲和力的详细文章:http: //www.energizedtech.com/2010/07/powershell-setting-processor-a.html
接受的答案有效,但仅适用于列表中的第一个进程。评论中的解决方案对我不起作用。
要更改所有同名进程的亲和性,请使用以下命令:
Powershell "ForEach($PROCESS in GET-PROCESS processname) { $PROCESS.ProcessorAffinity=255}"
255接受的答案中给出的掩码在哪里。
| 归档时间: | 
 | 
| 查看次数: | 31380 次 | 
| 最近记录: |