유닉스 명령에 해당하는 Windows 명령인 nice가 있나요?
작업 관리자의 <우선순위 설정> 메뉴가 아닌 명령줄에서 사용할 수 있는 것을 찾고 있습니다.
Google에서 이를 찾으려는 시도는 더 나은 형용사를 찾지 못하는 사람들에 의해 좌절되었습니다.
프로세스를 시작할 때 우선순위를 설정하려면 기본 제공 START 명령을 사용할 수 있습니다:
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/낮음 | /보통 | /높음 | /실시간 | /비정상 | /보통 이하]
[/WAIT] [/B] [명령/프로그램] [매개변수]
정상 이하 옵션을 사용하여 실행되는 명령/프로그램의 우선순위를 설정합니다. 가장 간단한 해결책처럼 보입니다. 다운로드나 스크립트 작성도 필요 없습니다. 다른 솔루션은 이미 실행 중인 프로세스에서 작동할 수도 있습니다.
PowerShell]1을 사용하는 경우 프로세스의 우선순위를 변경할 수 있는 스크립트를 작성할 수 있습니다. 모나드 블로그]2에서 다음과 같은 PowerShell 함수를 발견했습니다:
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)`""
}
PowerShell 프롬프트에서 다음과 같이 입력합니다:
set-ProcessPriority SomeProcessName "High"
http://techtasks.com/code/viewbookcode/567 에서
# This code sets the priority of a process
# ---------------------------------------------------------------
# Adapted from VBScript code contained in the book:
# "Windows Server Cookbook" by Robbie Allen
# ISBN: 0-596-00633-0
# ---------------------------------------------------------------
use Win32::OLE;
$Win32::OLE::Warn = 3;
use constant NORMAL => 32;
use constant IDLE => 64;
use constant HIGH_PRIORITY => 128;
use constant REALTIME => 256;
use constant BELOW_NORMAL => 16384;
use constant ABOVE_NORMAL => 32768;
# ------ SCRIPT CONFIGURATION ------
$strComputer = '.';
$intPID = 2880; # set this to the PID of the target process
$intPriority = ABOVE_NORMAL; # Set this to one of the constants above
# ------ END CONFIGURATION ---------
print "Process PID: $intPID\n";
$objWMIProcess = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2:Win32_Process.Handle=\'' . $intPID . '\'');
print 'Process name: ' . $objWMIProcess->Name, "\n";
$intRC = $objWMIProcess->SetPriority($intPriority);
if ($intRC == 0) {
print "Successfully set priority.\n";
}
else {
print 'Could not set priority. Error code: ' . $intRC, "\n";
}