Pages

Showing posts with label Windows Vista. Show all posts
Showing posts with label Windows Vista. Show all posts

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.

Vista and Command Prompt Here

Those of us who were using Windows XP and Microsoft PowerToys Command Prompt Here would miss this feature in Windows Vista. You will find that there is no equivalent of such a utility by Microsoft for Vista. This is so because of an obvious reason. Vista has already this feature built-in.

Open up Windows Explorer, hold the [Shift] key down, right-click on any folder on the details pane on the right, you will see "Open Command Window Here" menu item third in the pop-up menu. However, if you do this on the folder pane on the left of the Windows Explorer, this will not work. Disappointed?

Another way is to modify Vista's registry. Here is how this can be done. Navigate in your Registry to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell and create a key called Open Command Prompt Here. Set the default string to whatever text you want to appear in the right-click menu. Create a new key within your newly created command prompt named "command," and set the default string to cmd.exe /k pushd %L. You may need to add %SystemRoot%\system32\ before the cmd.exe if the executable can't be found.

The changes should take place immediately. Right click a folder in both the right and left panes of your Windows Explorer and your new menu item should appear.