Today I accidentally clicked on the AutoCAD LT shortcut in my toolbar for the umpteenth time, and groaned as my computer slowed to a halt while it booted up the behemoth program. I had to wait until it completely loaded the drawing styles, the layouts, and a blank drawing from template before I could click the "X" to close the program and get back to the thing I had actually TRIED to open.
This got me thinking to an article I had read on Lifehacker about how to prevent these mammoth applications from starting up without your permission on the mac - and whether there was an easy way to do this for Windows, too. A quick search of the comments pointed out that there might be some freeware/shareware applications that would do this (AutoHotKey, for example), but I wanted to do it without downloading/installing any more software. A lightbulb came on above my head - why not use a batch file?
About 5 minutes of reading gave me the code calls I needed to create a quick-and-dirty batch file (.bat) that would allow me to prompt the user whether they really wanted to open the application or not. Typing in 'y' or 'Y' would execute the application, anything else would close the prompt without opening the program. A few minutes of coding, a couple minutes of testing, and I was done. Success!
Read on for step-by-step instructions for how to craft one of these execution safeguards for yourself....
1. Pick the program you're going to safeguard. Any memory-hog program might be worthwhile to implement this on, be it PhotoShop, AutoCAD, or even something like iTunes, MS Office or Adobe Acrobat. It's up to you what you choose.
2. Find the name and path of the executable for the program. If you right click on the shortcut and select properties, you can see the directory path to the program, as well as the executable's name (XYZ.exe). Take note of what this is, you'll use it in the batch file to execute this when you are prompted.
3. Create the batch file for the safeguard. Open your favorite text editor (or notepad, if you don't have anything else, and copy in the following:
@ECHO off
cls
:start
ECHO.
set choice=
set /p choice=Do you want to open <Enter Your Program Name Here>? Y/N?
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='Y' goto yes
if '%choice%'=='y' goto yes
goto end
:yes
START <Enter Program Executable Name Here>
goto end
:end
EXIT
Note: Replace <text> with actual custom text for your application (remove <> when you replace, too!)
Save as XYZ.bat (name is up to you - I like to name it the same as the executable it will be loading, but that's my preference) in the executable directory.
Note - you don't have to do this, but it saves you from having to enter the application path, and you probably won't be accidentally deleting the batch file if you put it in the program file directory.
If your text editor won't let you save as anything but a .txt file, get a better text editor, or go to the file after you save and rename as XYZ.bat.
4. Create your shortcut from the .bat file. The easiest way to do this is to click on the .bat file and drag to your quicklaunch toolbar, which will automatically create the shortcut there. You can also right-click and select "create shortcut". Either way, just create one copy for now.
5. Customize your shortcut icon. The default .bat file icon is really ugly. You probably want it to look just like the icon of the application shortcut you'll be replacing so you can tell what program the shortcut is for. Easy enough to do.
a. Right click on the shortcut and select properties.
b. Click the "Change Icon" button - it may give you a warning that the .bat file contains no icons - just click ok and you'll be presented with a list from the default directory.
c. Navigate to the executable you'll be replacing and select that .exe file - usually they have one or more icons embedded in the .exe that you'll then be able to choose from. If not, try another icon from somewhere else that appeals to you.
d. Select the one you want, hit ok, and hit ok back out of the properties box.
6. Now that you have the shortcut the way you want it, copy it to all the locations you want (quicklaunch bar, start menu, desktop, app launcher, etc). Delete the shortcuts that link directly to the application, as you'll not be needing these anymore.
7. Congrats, you're done! The next time you accidentally click on one of these shortcuts, you'll get a dialog box asking if you want to open the program. You'll have to physically type 'y' or 'Y' to start it up, with any other key simply closing the prompt. No more inadvertent computer slowdowns for bulky applications you didn't mean to open!