How to Modify Windows Registry with VBS

Introduction

Editor's Note: Tom's Hardware is pretty heavily oriented toward, well, hardware. However, we thought you'd appreciate this valuable little voyage into Windows Visual Basic scripting (VBScript) and Windows Registry modification. Starting with this article, when we see something you might find interesting, whatever it may be, we'll let you know about it. Take it away Mr. Thomas.

I'm a sort of evangelist for VBScript. One of my goals here is to lure you into using this programming language. Even if you have no interest in VBScript, I'm going to show you how to do something that you may like: how to remove those annoying arrows on shortcuts. In addition to VBScript code, I'll provide instructions on how to accomplish the same task using simple Windows Registry .reg files.

Beware, the IsShortCut method works fine for XP and Windows Server 2003, but can produce ugly side-effects in Vista. Down the road a bit, I'll publish a separate Shell Icons script to remove the arrows from Vista shortcuts.

Thanks to the .reg files supplied, you don't actually have to study VBScript to get this job done. However, if you use or would like to use VBScript, the VBScript examples show how easy it is to create objects. In this instance the object and its .RegDelete method modify the Windows Registry. It almost goes without saying that in other scripts you can use different methods to automate any task that you can perform through a GUI.

Removing the arrows on shortcuts is a classic case of Microsoft having not one, but three ways of configuring a Registry setting; VBScript, a .reg file and of course regedit.

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.

Join our discussion on this topic