START /LOW SomeBatch.cmdAlternatively, one can embed the START command with the priority class modifier within the batch file itself, viz
@echo off setlocal enableextensions if %1@==@ ( start /low %0 running goto :eof ) echo This instance is running at LOW priority class pause exitOne could even make the priority class one of the parameters to the call, e.g.
@echo off setlocal enableextensions set PC=%1 if %PC%@==@ ( echo Please specify priority class as first argument. goto :eof ) if %2@==@ ( start /%PC% %0 %1 running goto :eof ) echo Supposedly running %PC% pause exitThe trick is to check, in the first instance, for something in the %1 slot, and in the second, in the %2 slot, with the assumption that 'nothing' means %0 is running for the first time. Note also, that no checking of meaningful priority classes is done. That's left as an exercise for the reader.
© Copyright Bruce M. Axtens, 2012
No comments:
Post a Comment