Thankyou, but s there a way for the application to run optimally even though it is being minimized?
I really need to run multiple applications at the same time.
Performance Issue When Minimize App
hi, I have a little problem here. Well, I ran the program(ansys) and it was running at 100% CPU usage. And these are ideal conditions. Then, when I opened another application and minimized it (the Ansys application) the CPU usage decreased and the analysis time increased. Meanwhile, when the ANSYS is displayed again, CPU usage returns to 100% and the analysis time in the ANSYS returns to normal, decreasing. Is there a solution to this problem because honestly this is very annoying in doing some work. Thank You.
Windows for home | Windows 11 | Performance and system failures
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
3 answers
Sort by: Most helpful
-
Anonymous
2024-07-16T03:41:18+00:00 -
Anonymous
2024-07-16T05:35:31+00:00 Thank you for your reply.
Here's what it looks like, and I have a code here that will pretty much do the job
A PowerShell script can be used to keep a minimized program constantly running at full capacity, which involves making sure that system resources are allocated to that process first. Here's a sample script that will monitor a specific process and continually set its priority high to ensure that system resources are allocated to that program first.
You can test it
Setting Process Priority with a PowerShell Script
- Create a PowerShell script:
You can create a new file in any text editor (e.g. Notepad) and save it with a .ps1 extension. The following is a sample script:
Set the name of your target application (e.g., "notepad" for Notepad application)
$processName = "notepad"
Function to check and set the process priority
function Set-ProcessPriority {
$processes = Get-Process -Name $processName -ErrorAction SilentlyContinue
foreach ($process in $processes) {
if ($process.PriorityClass -ne [System.Diagnostics.ProcessPriorityClass]::High) {
Write-Output "Setting priority for process ID $($process.Id) to High"
$process.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::High
}
}
}
Main loop: Check and set priority every 5 seconds
while ($true) {
Set-ProcessPriority
Start-Sleep -Seconds 5
}
- Run the PowerShell script:
Before running this script, make sure you have administrator privileges, as they may be required to adjust process priorities.
- Opening PowerShell: Press Win + X and select "Windows PowerShell (Admin)".
- Navigate to the directory where you saved the script. For example, if the script is saved in the C:\Scripts\ folder:
- cd C:\Scripts\
- Run the script:
- .\YourScriptName.ps1
where replace YourScriptName.ps1 with the name of your actual script file.
Interpreting Script Functions
- $processName: Sets the name of the process whose priority you wish to modify. Remember to modify this value and replace it with the name of your actual program.
- Set-ProcessPriority function: This function looks for all processes matching the specified name and updates their priority to High.
- Main loop: This part of the code loop checks the process every 5 seconds and sets its priority. This ensures that even if the priority of a process is changed by the system or other software, the script will be able to correct it in time.
Cautions:
- Performance Optimization:
- Setting the process priority to "high" can improve the resource allocation of the target process, but may also affect the performance of other applications.
- Please note that you should not set the priority to "Real Time" as this may cause the system to become unresponsive.
- Permissions and security:
- Modifying the process priority may require administrator privileges; if the script prompts for insufficient privileges, run PowerShell as an administrator.
- Persistent operation:
- You can set this script as a Windows Task Plan to run automatically at system startup.
- It is also possible to create a shortcut and place it in the startup folder.
With the above steps, you should be able to create and run a PowerShell script that will enable a specific program to keep running at high performance even when minimized.
But for the specific code, you need to upload the path to your program.
I hope you find the above information helpful!
Kirito|Microsoft Community Support Specialist
-
Anonymous
2024-07-15T02:35:27+00:00 Hello Diwanto Riko Sitanggang and welcome to the Microsoft Community!
According to your feedback, you are experiencing an issue where minimizing the application decreases the cpu usage.
I would like to check with you if you have experienced this before.
We have tested and found the same issue as you.
I think when you minimize the application, the cpu usage will be reduced in priority.
It will prioritize the programs you are using that are running in the foreground.
Or after minimizing, it will run the application at a lower priority to increase the cpu usage priority for the subsequent applications you will use.
We hope you find this information helpful.
Kirito|Microsoft Community Support Specialist