Two Visual Basic Scripts
Example 1 is relatively simple. It concentrates on creating objShell and applying the .RegDelete method.
Example 2 is more complex, and introduces limited error correcting code. Moreover Example 2 creates a substitute REG_SZ value, which is the equivalent of renaming IsShortCut.
These scripts are designed for XP and Windows 2003. While they will work on Vista, as noted above, they produce ugly side-effects on icons in the Favorites folder.
Example 1: Basic Script To Remove The Arrow On Shortcuts
- Preliminary step: In order to give the script a chance, create a shortcut. For example, at the desktop, right-click, new, shortcut and type 'calc'. Press 'Finish' and the shortcut, complete with arrow will arrive on the desktop.
- Copy and paste the script below into notepad, or get a script editor such as OnScript.
- Save the file with .vbs extension e.g. NoArrowEg1.vbs
- Double click your VBScript, then 'OK' the message box.
- To help you understand what is happening in the Registry, I recommend that you launch regedit and navigate to the section specified by strRoot.
- Ah yes, to actually see the arrows disappear, simply logoff and logon again. The shortcuts should now have no arrows.
' Example VBScript to remove arrows on shortcuts in XP
' and Windows 2003.
' Author Guy Thomas http: //computerperformance.co.uk
' Version 1.5 - March 2007
Dim objShell, strRoot, strRead, strDelete, strCreate
strRoot = "HKEY_CLASSES_ROOT\lnkfile\IsShortCut"
' Create the Shell object
Set objShell = CreateObject("WScript.Shell")
strDelete = objShell.RegDelete(strRoot)
WScript.Echo "Error No: " & err.number & " check " & strRoot
strDelete = null
' End of example script.
- Check how VBScript creates the objShell object, then trace how .RegDelete performs its work on the Registry.
- In VBScript HKEY_CLASSES_ROOT can be abbreviated to HKCR. (There is also HKLM and HKCU.) Surprisingly, you cannot use HKCR or HKLM in .Reg files.
- The RegDelete method deletes an entry from the Registry based on strName. If strName ends with a backslash (\), then strName is treated as a key, otherwise it is treated as a value.
- For completeness, you may wish to find other instances of IsShortCut, for example at: HKCR\piffile and HKCR\WSHFile.