Приоритет

 

MIKLE

старожил
★☆
Можно ли сделать так что-бы прграмма(один экзешник) запускалась не с обычным приоритетеом, а другим. А то какждый раз забываю менять вручную.
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
+
-
edit
 

Balancer

администратор
★★★★★
start /?

code text
  1. [...]
  2.  
  3. START ["заголовок"] [/Dпуть] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  4.       [/LOW | /NORMAL | /HIGH | /REALTIME| /ABOVENORMAL | /BELOWNORMAL]
  5.       [/WAIT] [/B]
  6.       [команда/программа] [параметры]
  7.  
  8. [...]
  9.  
  10.     LOW         Запуск приложения с приоритетом IDLE.
  11.     NORMAL      Запуск приложения с приоритетом NORMAL.
  12.     HIGH        Запуск приложения с приоритетом HIGH.
  13.     REALTIME    Запуск приложения с приоритетом REALTIME.
  14.     WAIT        Запуск приложения с ожиданием его завершения.
  15.     ABOVENORMAL Запуск приложения с классом приоритета ABOVENORMAL
  16.     BELOWNORMAL Запуск приложения с классом приоритета BELOWNORMAL
  17. [...]

 

MIKLE

старожил
★☆
Что с этим делать??? Куда вствлять?

ЗЫ надеюсь речь не об автозагрузке?
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
EE Татарин #16.07.2004 18:18
+
-
edit
 

Татарин

координатор
★★★★☆
Просто командная строка: start c:\mydir\myexe.exe /high, скажем.
...А неубитые медведи делили чьи-то шкуры с шумом. Боюсь, мы поздно осознали, к чему всё это приведёт.  

Rada

опытный

Если есть сорцы, можно через SetPriorityClass().
С себя можно начать когда все остальное будет в порядке.  
RU MIKLE #16.07.2004 22:18  @Татарин#16.07.2004 18:18
+
-
edit
 

MIKLE

старожил
★☆
Просто командная строка: start c:\mydir\myexe.exe /high, скажем.
[»]
 


Не хочет...
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
EE Татарин #16.07.2004 23:56  @Татарин#16.07.2004 18:18
+
-
edit
 

Татарин

координатор
★★★★☆
Просто командная строка: start c:\mydir\myexe.exe /high, скажем.
[»]
 


Не хочет...
[»]
 

O, mea culpa... Конечно, start /high c:\mydir\myexe.exe
Иначе /high уйдет как параметр запускаемой проги. :\
...А неубитые медведи делили чьи-то шкуры с шумом. Боюсь, мы поздно осознали, к чему всё это приведёт.  

MIKLE

старожил
★☆
Так вообще ничего не запускает. Говорит нет такой команды(/
ххх)
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  

Rada

опытный

У тебя Win 98?
С себя можно начать когда все остальное будет в порядке.  

Rada

опытный

Странно, должна быть.
code text
  1. P:\>start /?
  2. Starts a separate window to run a specified program or command.
  3.  
  4. START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
  5.       [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
  6.       [/WAIT] [/B] [command/program]
  7.       [parameters]
  8.  
  9.     "title"     Title to display in  window title bar.
  10.     path        Starting directory
  11.     B           Start application without creating a new window. The
  12.                 application has ^C handling ignored. Unless the application
  13.                 enables ^C processing, ^Break is the only way to interrupt
  14.                 the application
  15.     I           The new environment will be the original environment passed
  16.                 to the cmd.exe and not the current environment.
  17.     MIN         Start window minimized
  18.     MAX         Start window maximized
  19.     SEPARATE    Start 16-bit Windows program in separate memory space
  20.     SHARED      Start 16-bit Windows program in shared memory space
  21.     LOW         Start application in the IDLE priority class
  22.     NORMAL      Start application in the NORMAL priority class
  23.     HIGH        Start application in the HIGH priority class
  24.     REALTIME    Start application in the REALTIME priority class
  25.     ABOVENORMAL Start application in the ABOVENORMAL priority class
  26.     BELOWNORMAL Start application in the BELOWNORMAL priority class
  27.     WAIT        Start application and wait for it to terminate
  28.     command/program
  29.                 If it is an internal cmd command or a batch file then
  30.                 the command processor is run with the /K switch to cmd.exe.
  31.                 This means that the window will remain after the command
  32.                 has been run.
  33.  
  34.                 If it is not an internal cmd command or batch file then
  35.                 it is a program and will run as either a windowed application
  36.                 or a console application.
  37.  
  38.     parameters  These are the parameters passed to the command/program
  39.  
  40.  
  41. If Command Extensions are enabled, external command invocation
  42. through the command line or the START command changes as follows:
  43.  
  44. non-executable files may be invoked through their file association just
  45.     by typing the name of the file as a command.  (e.g.  WORD.DOC would
  46.     launch the application associated with the .DOC file extension).
  47.     See the ASSOC and FTYPE commands for how to create these
  48.     associations from within a command script.
  49.  
  50. When executing an application that is a 32-bit GUI application, CMD.EXE
  51.     does not wait for the application to terminate before returning to
  52.     the command prompt.  This new behavior does NOT occur if executing
  53.     within a command script.
  54.  
  55. When executing a command line whose first token is the string "CMD "
  56.     without an extension or path qualifier, then "CMD" is replaced with
  57.     the value of the COMSPEC variable.  This prevents picking up CMD.EXE
  58.     from the current directory.
  59.  
  60. When executing a command line whose first token does NOT contain an
  61.     extension, then CMD.EXE uses the value of the PATHEXT
  62.     environment variable to determine which extensions to look for
  63.     and in what order.  The default value for the PATHEXT variable
  64.     is:
  65.  
  66.         .COM;.EXE;.BAT;.CMD
  67.  
  68.     Notice the syntax is the same as the PATH variable, with
  69.     semicolons separating the different elements.
  70.  
  71. When searching for an executable, if there is no match on any extension,
  72. then looks to see if the name matches a directory name.  If it does, the
  73. START command launches the Explorer on that path.  If done from the
  74. command line, it is the equivalent to doing a CD /D to that path.
С себя можно начать когда все остальное будет в порядке.  
+
-
edit
 

Balancer

администратор
★★★★★
Команда start водится во всех Windows от Win95!
 
RU slipstream #20.07.2004 08:19
+
-
edit
 

slipstream

втянувшийся
Она конечно вводится, но важно куда ;)

---------------------------
start


Windows cannot find 'start'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.


OK

 


]which start.exe
c:\bin\which.exe no start.exe in (.. .. ..)
 


Это же встроенная в cmd.exe команда - для шорткатов придется добавлять cmd /c

MIKLE

старожил
★☆
Во. первая "цитата" аккурат то что вылазит у меня.

Как бороться?
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
RU slipstream #20.07.2004 19:17
+
-
edit
 

slipstream

втянувшийся
MIKLE

Бороться невозможно :P В 9x это водилось как отдельная программа, но в 2k/xp придется писать cmd /c start.

Есть ещё вот какой заменитель с расширенными возможностями: RunProcess

http://gearbox.maem.umr.edu/batch/f_w_util...e-Freeware.html

code text
  1. Version 0.523, Copyright (C)2002, Frank P. Westlake. The only way to the Father is through Jesus.
  2. Runs a process.
  3.  
  4. RunProcess [options] ProgramName [ProgramName's parameters]
  5.  
  6. OPTIONS (':' is optional):
  7.  /a:file      The contents of this file will be appended to the command line,
  8.               following a space (unless '/-a'), and line endings will be
  9.               converted to spaces. The length of the resulting command line is
  10.               limited by the system to 32kb.
  11.  /c:l|n|h|r   Set the priority class to low (l), normal (n), high (h), or
  12.               realtime (r). Realtime priority should not be used. Ex: /c:n
  13.  /desktop:[]  Desktop or window station and desktop (default=WinSta0\Default).
  14.  /d:DirName   Current directory for the process is 'DirName'.
  15.  /f:flags     Process flags, for experts only. 'flags' may be one or more of
  16.               the following (ex: /f:cgp):
  17.                 c  Create a new console window. Cannot be used with 'd'.
  18.                 d  Create a detached process. Cannot be used with 'c'.
  19.                 g  Create a new process group.
  20.                 p  Create the 16-bit application in a private VDM.
  21.                 s  Create the 16-bit application in the shared VDM.
  22.                 u  Create a Unicode environment.
  23.                 w  Create suspended process (if /fGW, CTRL-C resumes).
  24.                 b  If logon as user ('/u'), perform a batch logon.
  25.                 i  If logon as user ('/u'), perform an interactive logon.
  26.                 n  If logon as user ('/u'), perform a network logon.
  27.                 v  If logon as user ('/u'), perform a service logon.
  28.  /e:o|n       Send the process's STDERR to STDOUT (/e:o) or NULL (/e:n).
  29.  /o:e|n       Send the process's STDOUT to STDERR (/o:e) or NULL (/o:n).
  30.  /i           Ignore CTRL_LOGOFF_EVENT for use with SRVANY as a service.
  31.  /k:time      Kill the process if it does not finish in the specified time. If
  32.               not specified otherwise, the time will be read as milliseconds.
  33.               To indicate hours, minutes, or seconds, immediately follow the
  34.               time with one of the modifiers: h, m, or s. Ex: /k:3000 or /k:3s
  35.  /m[:BitMask] Process affinity mask. Ex: /m:1 (1), /m:11 (1,2), /m:10 (2).
  36.  /r[:o|e|c|n] Print a process report to STDOUT (o), STDERR (e), or directly to
  37.               the console window (c). The default is STDERR. Ex: /r or /r:o
  38.               or /r:n to disable all reporting. Any other string is a filename.
  39.  /u:username  If specified, the process will be logged on with the indicated
  40.               username. The username may be preceded with the domain name. Ex:
  41.               /u:fwestlake or "/u:NT Authority\system" or /u:.\fwestlake
  42.  /p[password] A plain text password that is necessary for username. If absent,
  43.               no password is used. If '/p' alone, password is read from STDIN.
  44.  /t:time      A time, date-time, period, or date-time interval (ISO8601:2000).
  45.               Format: [R[n]/][start-date]Tstart-time[/[end-date][Tend-time]]
  46.               Ex: /t:T23:36, /t:2002-09-11T23:36, /t:R3/T23:36/T23:45, /t:PT3S
  47.  /title:text  A console window title.
  48.  /v:file      Environment block for the process. One line per variable, lines
  49.               must be sorted. Leading spaces will not be removed. Format:
  50.               Variable Name=Variable value
  51.  /w:flags     Sets window options. 'flags' may be one or more of the following
  52.               followed by a value and separated by commas (Ex: /w:R80,L25):
  53.                 x  Window position, pixels from left of screen.
  54.                 y  Window position, pixels from top of screen.
  55.                 c  Window size, pixels from left to right.
  56.                 r  Window size, pixels from top to bottom.
  57.                 l  Consoles only, buffer size in characters from left to right.
  58.                 w  Consoles only, buffer size in lines from top to bottom.
  59.                 b  Consoles only, background color.
  60.                 f  Consoles only, foreground color.
  61.                 s  Window state (0=hidden, 1=normal, 2=min, 3=max)
  62.  /x           Do not wait for process to complete before repeating or exiting.
  63.  
  64. NOTES:
  65. - If the file name extension is not specified, a search will be conducted using
  66. the PATHEXT environment variable.
  67. - For extended command line lengths (/a) do not use CMD.EXE.
  68. - '/k' limits the duration of each occurance of ProgramName, '/t' with an end
  69. time or duration ends all repetitions of ProgramName.
  70. - if '/f:u' and '/v:file' are both specified, 'file' must be a Unicode file.
  71. - The 'ErrorMessage:' item in the report is only useful if the process is using
  72. Windows System Exit Codes. Some programs do, but not always.
  73.  
  74. EXAMPLES:
  75.   Run a process and wait for it to complete:
  76.     RunProcess ProgramName
  77.  
  78.   Run a low priority process, wait for it to complete or kill it in 5 seconds,
  79.   and print a report to the console instead of STDERR:
  80.     RunProcess /c:l /k:5s /r:c ProgramName
  81.  
  82.   Run a process as another user and wait for it to complete:
  83.     RunProcess /u:accounting\ksmith /p:secret ProgramName
  84.  
  85.   Repeat a process indefinately from 12:00 to 13:00, kill each instance that
  86.   lasts longer than 2 minutes and kill the last instance at 13:00:
  87.     RunProcess /t:R/T1200/T1300 /k:2m ProgramName
  88.  
  89.   Run a process on the default desktop and do not wait for it to complete:
  90.     RunProcess /x /f:c /desktop ProgramName
RU slipstream #20.07.2004 19:21
+
-
edit
 

slipstream

втянувшийся
А этот один экзешник, он консольный или гуйный? И запускается автоматом или вручную?

MIKLE

старожил
★☆
Запускается вручную.
Софтина для измерений. Утром включил вечечером выключил. Хоца чтоб при включении(запуске ЕКЗЕшника) запускалось с высоким(реального времени) приоритетом(иначе глючит, "выбросов" много).
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
+
-
edit
 

Mishka

модератор
★★★

Должно стартовать нормально. Только полный путь указывай. Вот например, у меня так:

code text
  1. start /abovenormal c:\tools\memtaker.exe
 

Rada

опытный

2 MIKLE: Real-time приоритет ты не выставишь - нужны права System, то есть нужно писать ядерное приложение. Но это и не нужно - достаточно выставить High приоритет, тогда твоё приложение будет гарантированно получать свою квоту времени на исполнение.
С себя можно начать когда все остальное будет в порядке.  

MIKLE

старожил
★☆
Права систем вроде есть. Хотя не провеорял. Реал тайм лучше.

комаду start/ оно не видит/ругается
Модифицированым комплексам модифицированые танки. (С) VooDoo ХАЧУУУ МАТАЦИКЛ!!!!!!  
+
-
edit
 

Mishka

модератор
★★★

Ежели запустишь cmd (command prompt) и в нем наберешь "start /?" - то что видишь?
 
+
-
edit
 

Balancer

администратор
★★★★★
А ещё можно SP-Forth использовать. Всего [70кБ, а полноценная система программирования с вызовом любых Win32-функций, хоть прямо из командной строки :)

spf4.exe WINAPI: CreateProcessA KERNEL32.DLL .... CreateProcessA ... BYE

:)

Или можно готовые модули подключать.
 
Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.

C:\Documents and Settings\Mikle>C:\dat\izmerenia\rcl\rcl.exe /high
"C:\dat\izmerenia\rcl\rcl.exe" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

C:\Documents and Settings\Mikle>
 
Блин туплю. В итоге запустлось, но как обычно :)

Ладно, поизвращался и хватит. Проще ручками. Склероз лечить.
Всем спасибо. Все свободны. (С) :)
 
RU slipstream #22.07.2004 19:22
+
-
edit
 

slipstream

втянувшийся
..
Ладно, поизвращался и хватит. Проще ручками. Склероз лечить.
Всем спасибо. Все свободны. (С)
 

Вот это напрасно =) Со склерозом дальше будет только хуже, так что лучше уж автоматизировать всё что можно, пока не стало совсем лень ;P

Для примера - нужно запустить "C:\Program Files\7-ZIP\7zFM.exe" с высоким приоритетом.

Вариант с записью непосредственно в ярлык:
  • с использованием встроенной в 2k/xp команды: cmd /c start /REALTIME "" "C:\Program Files\7-ZIP\7zFM.exe" nb: первая пустая пара кавычек нужна из-за того, что start ожидает первой закавыченной строкой заголовок окна


  • с использованием RunProcess: RunProcess /x /c:r "C:\Program Files\7-ZIP\7zFM.exe"

Вариант с записью только в .cmd:

То же самое можно записать в .cmd или .bat файл и из ярлыка запускать уже его, тогда ситуация с командой start упрощается - можно писать без cmd /c.

nb: минус - придется в батнике лишний раз писать полны путь к программе

Вариант с записью частично в .cmd, частично в ярлык:

В .cmd забить только начало команды cmd /c start /REALTIME "" %* а имя программы "C:\Program Files\7-ZIP\7zFM.exe" передавать в ярлыке

Аварийный вариант

Минус задания приоритета при запуске - не сработает если программа при старте сама зачем-то переустанавливает собственный приоритет.
Тогда можно установить ей приоритет чуть позже запуска, таким например батником:
code dos
  1. start "" "C:\Program Files\7-ZIP\7zFM.exe"
  2. sleep 10s
  3. pv -pr 7zFM.exe

sleep брать тут - http://unxutils.sourceforge.net/UnxUtils.zip
pv - http://www.xmlsp.com/pview/PrcView.zip

минусы - не сработает для дос задач, приоритет выставляется для всех процессов с похожим именем

Аварийный вариант + nncron

Будет срабатывать автоматически при запуске заданной программы:

code forth
  1. <%
  2. WINAPI: SetPriorityClass KERNEL32.DLL
  3. 0x00000020 CONSTANT NORMAL_PRIORITY_CLASS
  4. 0x00000040 CONSTANT IDLE_PRIORITY_CLASS
  5. 0x00000080 CONSTANT HIGH_PRIORITY_CLASS
  6. 0x00000100 CONSTANT REALTIME_PRIORITY_CLASS
  7. 0x00004000 CONSTANT BELOW_NORMAL_PRIORITY_CLASS
  8. 0x00008000 CONSTANT ABOVE_NORMAL_PRIORITY_CLASS
  9. %>
  10.  
  11. #( priority_reset
  12. WatchProc: "C:\Program Files\7-ZIP\7zFM.exe"
  13. 0 VALUE hproc
  14. Action:
  15.   5000 PAUSE
  16.   WATCH-PROC-ID FALSE 0x200 OpenProcess DUP TO hproc
  17.   IF
  18.     HIGH_PRIORITY_CLASS hproc SetPriorityClass DROP
  19.     hproc CloseHandle DROP
  20.   THEN
  21. )#

nncron брать тут - nnSoft: nnCron, nnCron LITE, nnBackup
Это сообщение редактировалось 22.07.2004 в 22:29

в начало страницы | новое
 
Поиск
Настройки
Твиттер сайта
Статистика
Рейтинг@Mail.ru