My VBScript method, which deletes the IsShortCut value, works for both XP and Vista machines. However beware, because in Vista, removing this Registry value causes problems with shortcuts in the Favorites folder.
If you just want to remove the arrows quickly, use the .reg file. If you are using my VBScript to remove the arrows, the .reg files provide a complimentary method for resetting the Registry before you run the script for a second time.
A hidden bonus of using a script to remove the shortcut arrows is that you learn about the full range of Registry commands: .RegWrite, .RegDelete and .RegRead.
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
Instructions
- 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.
' NoArrowEg1.vbs
' Example VBScript to remove arrows on shortcuts in XP
' and Windows 2003.
' Author Guy Thomas http: //computerperformance.co.uk
' Version 1.5 - March 2007
' ---------------------------------------------------------------'
'
Option Explicit
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
WScript.Quit
' End of example script.
Learning Points
- 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.
Example 2: Full Script To Remove The Arrow On Shortcuts
Rather than just delete the appropriate Registry value, I have also decided to create a new Registry value. This achieves the illusion of renaming the original value IsShortCut to IsNotShortcut. From a learning point of view, this extra code provides examples of .RegWrite and .RegRead. From a strategic point of view this script introduces primitive error correcting code. In particular the 'If' section, together with On Error Resume Next, copes with the situation where you run the script for a second time.
Instructions
- If you have already run Example 1, you may want to run the second .reg file to restore the 'IsShortCut' value.
- I expect that you have a shortcut on the desktop, if not: 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. NoArrowEg2.vbs
- Double click your VBScript, then 'OK' the message box.
- I recommend that you investigate the Registry section specified by strRoot.
- Ah yes, to actually see the arrows disappear, simply logoff and logon again. The shortcuts should now have no arrows.
' NoArrowEg2.vbs
' Example VBScript to remove arrows on shortcuts on XP
' and Windows 2003.
' Author Guy Thomas http: //computerperformance.co.uk
' Version 2.3 - March 2007
' ---------------------------------------------------------------'
'
Option Explicit
Dim objShell, strRoot, strRegRead, strNew
Dim strRead, strDelete, strCreate
err.number = 0
strRoot = "HKCR\lnkfile\"
strNew = strRoot & "IsNotShortCut"
strRegRead = strRoot & "IsShortCut"
' Create the Shell object
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
strRead = objShell.RegRead(strRegRead)
If err.number => 0 then
strCreate = objShell.RegWrite(strNew,"", "REG_SZ")
strDelete = objShell.RegDelete(strRegRead)
End if
WScript.Echo "Error No: " & err.number & " check " & strRoot
On Error GoTo 0
strCreate = null
strDelete = null
WScript.Quit
' End of example script.
Learning Points
- The If err.number section has primitive error correcting code to prevent the script halting if you run it for a second time.
- RegWrite also has the implicit create property. Observe how it creates the parent value, and then assigns it a value. To emphasise the point, before the script runs for the first time, there is no 'IsNotShortCut' value. Yet thanks to .RegWrite a new REG_SZ called 'IsNotShortCut' is added to the Registry with a null value (""). A null value can actually be checked for in statements such as the "If" statement.
- 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.
Using .reg Files To Modify The Registry
Here are two .reg files. The first removes shortcut arrows. The second restores arrows to shortcuts. Both are designed for XP and Windows Server 2003, but will work on Vista within the limits noted above.
Instructions
- Copy the text into notepad.
- Save as ArrowGone.reg
- Double click the file and its contents are merged with your Registry.
- Note the minus sign in: "IsShortCut"=-. There are no quotes around the (-). This deletes the value of IsShortCut and IsShortCut itself. If you tried "IsShortCut"="-", then you would not delete the value and shortcut, but instead you would set its value to a minus sign. "IsNotShortCut"="" creates the key and sets its value to null.
.reg File To Remove Arrows On Shortcuts
Important: You need a blank line between "Windows Registry Editor Version 5.00" and [HKEY...]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\lnkfile]
"IsShortCut"=-
"IsNotShortCut"=""
That's it!
.reg File To Display Arrows On Shortcuts
This .reg file returns the Registry to its default configuration, where shortcuts display an arrow. The script below reverses the script above.
Instructions
- Copy the text into notepad.
- Save as ArrowBack.reg
- Double click and merge with your Registry.
- Note that "IsShortCut" now reads "IsShortCut"="". This re-creates the variable and sets it to blank. IsNotShortCut is deleted this time.
Important: Again, you need a blank line between Windows Registry Editor Version 5.00 and [HKEY...]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\lnkfile]
"IsShortCut"=""
"IsNotShortCut"=-
Again, that's it!
Conclusions
Those arrows on shortcuts can be most annoying. My methods remove the Registry entry which controls these arrows. The scripting techniques show you how to employ .RegWrite, .RegRead and especially RegDelete to control the appropriate Registry values.
I have also included .reg files, these are a quicker and more convenient method for achieving the same goal, removing the arrow from shortcuts.
No comments:
Post a Comment