Pages

Autoexec with Windows Vista

In the days of Windows 98, commands which you wish to execute when the system starts up are placed in the autoexec.bat file. One of the useful things to do is to remove all temporary files in the temp folder. For example, we could issue these commands in the autoexec.bat file.
REM *** inside autoexec.bat ***
cd C:\temp
del *.tmp

Each time when the system reboots, those files with extension tmp will be removed in the temp folder of C: drive.

How to do this in Windows Vista? The autoexec.bat concept is not used in Vista. However, we can tell Vista to do this by specifying a Local Group Policy on the script to execute during Windows startup. We can do this by using the Local Group Policy Editor.

Open the Run... Dialog Box from the Windows Start menu. Key in "gpedit.msc" to start the Local Group Policy Editor.

image

When the Local Group Policy Editor appears, expand on the left pane, Local Computer PolicyComputer ConfigurationWindows SettingsScripts (Startup/Shutdown).

image

Double click on the right pane, Startup. Click on the Add button and specify the script you want Windows to execute during startup. In this case, I placed the delete commands in a script called cleartemp.bat.

image

Click OK and we are done! Exit the editor. Test out the script by restarting Windows Vista.