I would like to know if there is a possibility of giving a priority to all processes involved in a pipe
Example:
Code: Select all
batch1.cmd | batch2.cmd
I wish that all the children processes involved were assigned the same priority
How can I do?
Moderator: DosItHelp
Code: Select all
batch1.cmd | batch2.cmd
Code: Select all
LOW
NORMAL
HIGH
REALTIME
ABOVENORMAL
BELOWNORMAL
Code: Select all
start "" /b /LOW cmd /c batch1.cmd | start "" /b /LOW cmd /c batch2.cmd
Code: Select all
@echo off
echo [ZERO] [%time%] > CON
start "" /b /HIGH cmd /c batch1.cmd | start "" /b /HIGH cmd /c batch2.cmd
Code: Select all
@echo off
echo [ONE] [%time%] > CON
start "" /b /HIGH cmd /c batch1_1.cmd | start "" /b /HIGH cmd /c batch1_2.cmd
Code: Select all
@echo off
echo [TWO] [%time%] > CON
:two
set "ln="
set /p "ln="
if defined ln echo [Two] [%time%] %ln%
goto :two
Code: Select all
@echo off
echo [ONE_ONE] [%time%] > CON
typeperf "\Processore(_Total)\%% Tempo processore"
Rem typeperf "\Processor(_Total)\%% Processor Time"
Code: Select all
@echo off
echo [ONE_TWO] [%time%] > CON
more +2
jeb wrote:So if you want to use it with pipes you could add the start command at each side.
Code: Select all
C:\tmp>start "" /b /LOW cmd /c echo 123 | start "" /b /LOW cmd /c more
123
^Z
C:\tmp>
Code: Select all
start "" /high /b "cmd" /c "batch1.cmd" |start "" /high /b "cmd" /c "batch2.cmd"
Liviu wrote:jeb wrote:So if you want to use it with pipes you could add the start command at each side.
Interesting thought, thanks for the hint. That said, there is something odd with piping between two "start" commands. The following requires an ^Z to be manually entered before the command completes.Code: Select all
C:\tmp>start "" /b /LOW cmd /c echo 123 | start "" /b /LOW cmd /c more
123
^Z
C:\tmp>
Liviu
Code: Select all
C:\Documents and Settings\fra>cmd /c more
^D
♦
^A
☺
^X
↑
^B
☻
^Z
C:\Documents and Settings\fra>
Ed Dyreen wrote:'
Some time ago, I discover a bug in the start command of winXP causing priority changes to fail.
Just switching the order of the parameters should do it ( I hope ).Code: Select all
start "" /high /b "cmd" /c "batch1.cmd" |start "" /high /b "cmd" /c "batch2.cmd"
Code: Select all
start "" /HIGH /b "cmd" /c "batch1_1.cmd" | start "" /HIGH /b "cmd" /c "batch1_2.cmd"
Code: Select all
@echo off
start "" /high /b "cmd" /c "1.cmd" |start "" /high /b "cmd" /c "2.cmd"
pause
exit
Code: Select all
@echo off
echo.%~n0
pause
einstein1969 wrote:It's more problem?Code: Select all
C:\Documents and Settings\fra>cmd /c more
^D
♦
You are piping into 'start', not into 'more'.Liviu wrote:The "odd" part in my previous example was the additional ^Z required when piping between "start cmd /c" commands, which is not otherwise necessary when running the commands directly e.g. "echo 123 | more".
Code: Select all
echo.123 |start "" /b cmd /c more
Code: Select all
echo.123 |more
Code: Select all
>more
^Z
>echo.123 |start "" /b cmd /c more
123
^Z
>
Ed Dyreen wrote:You are piping into 'start', not into 'more'.
Code: Select all
C:\tmp>echo 123 | (cmd /c more)
123
C:\tmp>echo 123 | (start /b cmd /c more)
123
^Z
C:\tmp>
Ed Dyreen wrote:'
Odd, did you verify with taskManager ?, I ran
'test.CMD''1.CMD' And '2.CMD'Code: Select all
@echo off
start "" /high /b "cmd" /c "1.cmd" |start "" /high /b "cmd" /c "2.cmd"
pause
exitand process '2.CMD' runs high as I expected ( did not verify priority of '1.CMD' )Code: Select all
@echo off
echo.%~n0
pause
Liviu wrote:Ed Dyreen wrote:You are piping into 'start', not into 'more'.
Right. My first post was in reply to jeb's clever usage of 'start'. The point I was making is that, with piped input, the 'start' behavior does not match the same command being run directly, but (sometimes?) requires an extra ^Z to close the pipe.
In more detail......the first command completes without any additional input, while the second one needs that extra ^Z. The difference is definitely with the receiving end of the pipe i.e. the 'start' part, since running the second line without "/b" opens (as expected) a separate console, and waits for a ^Z to be entered there.Code: Select all
C:\tmp>echo 123 | (cmd /c more)
123
C:\tmp>echo 123 | (start /b cmd /c more)
123
^Z
C:\tmp>
Liviu
Code: Select all
echo 123 | (start /b /wait cmd /c more)
Code: Select all
14.06.02,21> echo 123 | (start /b /wait cmd /c more)
123
14.06.07,43>
Code: Select all
14.06.07,43> echo 123 | (start /wait /b cmd /c more)
123
^Z
14.07.16,77>