Vra

Is daar 'n Windows ekwivalent van die opdrag Unix, lekker

Ek is spesifiek op soek na iets wat ek kan gebruik by die command line, en nie die spyskaart "Stel prioriteit" van die taak bestuurder.

My pogings om die vind van hierdie op Google is in die wiele gery word deur diegene wat nie kan kom met 'n beter adjektiewe.

Was dit nuttig?

Oplossing

As jy wil prioriteit stel wanneer die launch van 'n proses wat jy kan gebruik maak van die ingeboude in aanvang opdrag:

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

Gebruik die lae deur belownormal opsies om prioriteit te stel van die begin opdrag / program. Lyk asof die meeste eenvoudige oplossing. Geen downloads of script skryf. Die ander oplossings waarskynlik werk op reeds aan die gang procs al is.

Ander wenke

As jy gebruik PowerShell , jy kan skryf 'n script wat laat jy die prioriteit van 'n proses te verander. Ek het gevind dat die volgende PowerShell funksie op die monade 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)`""
}

Van die PowerShell vinnige, sou jy iets lyn doen:

set-ProcessPriority SomeProcessName "High"

Miskien het jy wil om te oorweeg die gebruik van ProcessTamer dat "automatiseren" die proses van afgradering of opgradering proses prioriteit gebaseer in jou stellings.

Ek het al met behulp dit vir twee jaar. Dit is baie eenvoudig, maar regtig doeltreffende!

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";
}

PrcView lyk goed af te werk die command line:

http://www.teamcti.com/pview/prcview.htm

(Check die parameter -ph)

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top