问题
Does anybody know how to manipulate this code so that the FINDSTR process always is assigned high priority?
FORFILES /P C:\path /M * /C "cmd /c FINDSTR /c:"@FILE" C:\path\*">C:\path\repgenresults.txt
I tried assigning priority manually in Task Manager, but I would need to do that a couple thousand times, because each new process with a new iteration of the loop is assigned normal priority. I also tried combining the cmd and start functions without much luck. Any ideas?
回答1:
You could put everything inside a batch file then use the command START to execute the batch file with the priority choosen
See START references
Example
START "RunAsHighPriority" /HIGH /WAIT YourCommand.cmd
来源:https://stackoverflow.com/questions/10761057/windows-command-line-assign-high-priority-to-findstr-within-a-loop