Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Equivalent of 'nice'

Is there a Windows equivalent of the Unix command, nice?

I'm specifically looking for something I can use at the command line, and not the "Set Priority" menu from the task manager.

My attempts at finding this on Google have been thwarted by those who can't come up with better adjectives.

like image 483
Ryan Fox Avatar asked Aug 07 '08 00:08

Ryan Fox


People also ask

What is nice in operating system?

Description. The nice command lets you run a command at a priority lower than the command's normal priority. The Command parameter is the name of any executable file on the system. If you do not specify an Increment value the nice command defaults to an increment of 10.

What is the Windows equivalent of Which?

The where command is a Windows which equivalent in a command-line prompt (CMD). In a Windows PowerShell the alternative for the which command is the Get-Command utility.

What is the default nice level?

The nice value determines the priority of the process. The higher the value, the lower the priority--the "nicer" the process is to other processes. The default nice value is 0 on Linux workstations. The SZ field displays the size of the process in memory.


2 Answers

If you want to set priority when launching a process you could use the built-in START command:

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]       [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]       [/WAIT] [/B] [command/program] [parameters] 

Use the low through belownormal options to set priority of the launched command/program. Seems like the most straightforward solution. No downloads or script writing. The other solutions probably work on already running procs though.

like image 88
Stephen Pellicer Avatar answered Oct 24 '22 10:10

Stephen Pellicer


If you use PowerShell, you could write a script that let you change the priority of a process. I found the following PowerShell function on the Monad blog:

function set-ProcessPriority {      param($processName = $(throw "Enter process name"), $priority = "Normal")      get-process -processname $processname | foreach { $_.PriorityClass = $priority }     write-host "`"$($processName)`"'s priority is set to `"$($priority)`"" } 

From the PowerShell prompt, you would do something line:

set-ProcessPriority SomeProcessName "High" 
like image 45
Chris Miller Avatar answered Oct 24 '22 12:10

Chris Miller