1

i use this code to set the priority of a running program:

set /p input=Program name:
wmic process where name="%input%" CALL setpriority "high priority"

Is there a way i can run the batch file then open my program and let the batch set priority without typing the name? mabye something that looks like this:

timeout 3 /nobreak >nul
wmic process active window CALL setpriority "high priority"
kno010
  • 411
  • 1
  • 4
  • 5
  • See `start /?` you can start a program AND set its' Priority. `start "" /wait /high c:\folder\myprogram.exe` –  Jun 13 '16 at 23:25
  • PS Any active window automatically gets a priority boost. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684828(v=vs.85).aspx –  Jun 14 '16 at 03:24
  • @Noodles I will use this on already open programs so the start command cant do it. I know that active programs gets a priority boost, but i want my programs to run at high even i a diffrent program is active. – kno010 Jun 14 '16 at 11:42
  • That not quite what your question says. *Is there a way i can run the batch file then open my program and let the batch set priority*. –  Jun 14 '16 at 11:55
  • 1
    You cannot easily get active windows in scripting languages (programs shouldn't mess with other programs). You can make a .NET executable (see my post http://stackoverflow.com/questions/26341753/how-to-find-the-window-title-of-activeforeground-window-using-window-script-ho/26369890#26369890). –  Jun 14 '16 at 11:59

0 Answers0