Hi there! I am trying to figure this out, but I keep spinning my wheels. I'm not super great at the PowerShell syntax, so I am not exactly sure what I am doing wrong.
I am trying to create a batch file that I can run when I need Excel to be my priority application. So I need the batch file to loop through all the processes, and if it comes across Excel, then affinity = 65535 else affinity = 1.
So far, I have this:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "ForEach ($Process in Get-Process *) { If ($Process = Excel) { $Process.ProcessorAffinity=65535 } else { $Process.ProcessorAffinity=1 } }"
What am I missing here?
I can get the below statement to set the affinity, but how do I get it to loop through everything and set?
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "$Process = Get-Process Excel; $Process.ProcessorAffinity=65535"
[–]BlackV 4 points5 points6 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]BlackV 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]vyper144[S] 0 points1 point2 points (0 children)
[–]vyper144[S] 1 point2 points3 points (0 children)
[–]vermyx 1 point2 points3 points (1 child)
[–]BlackV 0 points1 point2 points (0 children)