We are a commune of inquiring, skeptical, politically centrist, capitalist, anglophile, traditionalist New England Yankee humans, humanoids, and animals with many interests beyond and above politics. Each of us has had a high-school education (or GED), but all had ADD so didn't pay attention very well, especially the dogs. Each one of us does "try my best to be just like I am," and none of us enjoys working for others, including for Maggie, from whom we receive neither a nickel nor a dime. Freedom from nags, cranks, government, do-gooders, control-freaks and idiots is all that we ask for.
Our Recent Essays Behind the Front Page
Tuesday, December 11. 2012
This deals with taking a program that uses high CPU and lowering its 'priority' so it won't drag the system down, but will still hustle along as fast as it can otherwise. I suppose this is mainly for the field of video, because traditionally video conversion programs are power-hungry and slow, but it would relate to any CPU-hungry situation.
We'll be dealing with batch files, DOS, strings and variables.
Only the strong will survive.
Mentally gagging at the mere thought of having to perform this hard manual labor, the next step is to automagically run the program via a batch file. You use the DOS 'Start' command to start the program with a low priority:
Start /LOW c:\video\coolprog.exe
And there ya go. Now it'll tool along in the background and be barely noticeable.
Step By Step
If you've never made a batch file before, here's how you do it:
— Open Notepad and scribble out your code. Save it wherever it goes.
— Change the file extension from ".txt" to ".bat". If you're not seeing file extensions, open Control Panel, Folder Options, the 'View' tab, uncheck 'Hide extensions...'.
Double-click on the file to run. If you want the DOS box to stay open after it's finished, put the DOS command 'Pause' on the last line.
When it's working, check the program's priority in Task Manager. Assuming it's 'Low', it's time for the finishing step:
— Grab the BAT icon with the mouse and d-r-a-g it over to the Start Menu and drop it in next to the original icon, then delete the original.
— Right-click on it, 'Rename', get rid of the ".bat".
— Open its 'Properties', set the 'Run' entry to 'Minimized'. That'll keep the ugly black DOS box from popping up. Then click on 'Change Icon' and browse to the original program, OK, OK, OK.
Problems in Happyland
The above works for four of the six video programs I want to tame. With the other two, I ran into very different problems:
— With Flash 8, the DOS box would just go blink! and the program wouldn't run. It would run straight from a DOS box, but not with the Start command.
— DVD Architect would fire right up, but with a normal priority.
And so over the years I've had to painstakingly, backbreakingly reset the priorities of those two programs manually via Task Manager. I've been thinking about writing a book on my travails.
Then the other day two of my brain synapses accidentally collided and I had a thought. I tried using the Start batch file to run another batch file. Such is the power and glory of random synaptic mutation.
And it worked! The first one, called "coolprog1.bat", reads:
Start /LOW coolprog2.bat
This does nothing but run another batch file named "coolprog2.bat", albeit this time with a low priority. The second one fires up the program:
This assumes both batch files are in the same folder. Note the path is in quotes because of the blank space; they're not necessary if there isn't. The 'Exit' command closes the DOS window after the program closes and the batch file continues.
As noted, this trick also worked for the program that ran fine but with a normal priority.
Any questions or additions, like usual, give a holler.
Display comments as (Linear | Threaded)
My hubby's going to give you a great big kiss for this, Doc. (or perhaps I should) He was complaining just last night about some program that was hogging the whole system, I think Adobe Premiere. This oughta shut him up. :-)
Yeah, the Adobe products, like Premiere and After Effects, are just as bad as anybody. Ironically, I use three freebie video programs that have their own built-in adjustable priority settings, yet none of the big boys do. Probably too 'intricate' a setting for the crowd they're selling to. The three freebies were written by videophiles for videophiles. Big difference. Crappy, plain GUIs; fabulous 'intricate' function.
Does hubs know about my VideoLab site? Even if he doesn't get into the main (commercial) VideoStudio program, there's a real nice collection of the aforementioned freebie video tools, with instructions.
So anything started from the first batch file in /LOW mode will inherit that priority. Very slick indeed. ☺
One thing I didn't understand is why you used "c:\video\cool prog\coolprog.exe" in the second file. I would have used "c:\video\coolprog.exe". An explanation would be much appreciated.
The actual EXE is in the 'Cool Prog' folder, inside of the main 'Video' folder, hence its inclusion in the path.
And I figured I'd better throw in an example with a blank space, just to make sure that base is covered. If one's just used to Windows, where blank spaces rarely matter, it might not even occur to him that the blank space was what was keeping the batch file from running.
And -- if I may ask you to bare your favoritest secret -- can you tell me how you generated the smiley face? Character Map or Alt code? Fontset and key? I ask, because I'm thinking of putting together a post on font tricks, like how to generate ones that aren't normally found in the standard fontsets, like Arial and Verdana.
Well, in all fairness to Windows, there's probably some program out there that lists every EXE on the system and you simply check the priority box you want. No muss, no fuss. The trouble is finding it. Type twenty related keywords into Google and you'll still end up with 1.2 million hits.
FWIW, I've found a couple that will change it while it's up -- which is no different than Task Manager, but none that'll tweak them 'permanently'. But that's not saying it's not out there.
Alt-1 (on the number pad), or Alt-2 for a "negative" of it.
Haven't found one for a sad face, but in a lot of programs (including email clients) you can use J, K, L with the Wingdings font to get happy, neutral, and sad faces.
Hey, you're right -- silly me thought all Alt combos were four numbers. The other single numbers are kinda worthless, though, outside of "I ♥ Sarah Palin". Cool trick on your part.
In any of the UNIX-en, use 'nice' to make it play nice.
If you have to use Windows you have several options:
If you're using Sysinternals' Process Explorer instead of Task Manager (and you should) you can simply right-click on a process' name and set its priority there. You can get it from MS on Technet:
Or, lock it to a single core (or two or three, depending on how many you have) and be done with it. When I was stuck using Outlook I always tied it's club foot to the fourth core that never seemed to get used otherwise:
I have Process Explorer on the system and use it more than Device Mangler (I especially like the 'CPU History'), but for this crowd, I have to give them something they already have on their system.
And Process Explorer, like Device Manager, just lets you change it after it's already up. Not the same thing.
Just got another "Update Adobe Flash"...
IYHO...Accept or Reject...?
As long as it's been working fine, update. No reason why not.
Great article, Doc, got a friend who's gonna love it. He's also a video nut like you. This CPU biz is a big deal, apparently? I don't think I'd recognize a CPU-hungry program if it bit me on the ankle.
Oh, yes, you would. Your first thought would be, "Why does it feel like I'm swimming underwater?" Everything just feels kind of sluggish. Lowering its priority basically tells it, "You can use as much CPU as you like -- as long as the Great Master Operator isn't using any."
I might point out that it's no accident the jumper settings on an IDE hard drive are "master" and "slave".
A computer should know its place. :)