Kriattiffer
Kriattiffer

Reputation: 647

How to start executable with realtime priority?

So I try this on windows 8.1:

start /low cmd

And I get cmd process with low priority. But when I do:

start /realtime cmd

I get new cmd process with high priority.

Is there a way to get realtime without setting it manually? Also, can I somehow set desired priority from the code of my application, maybe WinApi or something?

Upvotes: 6

Views: 11391

Answers (3)

user10221137
user10221137

Reputation: 41

To make realtime work from CMD or Process Lasso without admin rights, it needs to be changed in:

secpol.msc > Local Policies > User Rights Assignment > Increase Scheduling Priority > Properties > Add user or group > Write down "Everyone" > check name > OK

I needed the solution to launch VBS script running CMD with priority set command in background, I couldn't open VBS script as admin.

Upvotes: 3

IT-Dan
IT-Dan

Reputation: 565

@ECHO OFF
ECHO Setting process priority    
wmic process where name="process.exe" CALL setpriority "Realtime"

A solution is to start the process as you are, but then run the above batch script file as administrator.

Upvotes: 1

Christian.K
Christian.K

Reputation: 49230

It works when you are executing start as an administrator.

Technically, you need the SeIncreaseBasePriorityPrivilege, which an administrator normally has. If you don't, it looks like albeit I couldn't find any documentation about that fact, that you are silently reverted to a priority that is still viable with the calling account.

I doubt that Win32 will help, as the same restrictions surely apply.

Upvotes: 7

Related Questions