Wednesday, April 1, 2009

Customizing BgInfo to include the installed runtimes


Customizing BgInfo to include the installed runtimes

Published 01 April 09 10:59 AM | psheill

Almost without exception, Windows developers use the tools from Sysinternals such as Process Explorer.  Another one that I've recent adopted is BgInfo, which displays useful system info on your desktop to save time and help distinguish multiple machines (Hyper-V users, you know what I mean).  I often find myself checking to see which .NET Runtimes are installed on a machine.  Standalone, BgInfo doesn't include any information about runtimes, but it does allow for customization, and that's what inspired this post.  I wrote a small script that will list the runtimes it finds installed on your system - when called by BgInfo, the runtime versions will be displayed on the desktop.  To use, just create a file called "runtimes.vbs" with the following contents.  Then run BgInfo, press the "Custom" button, "New", type ".NET Runtimes" for the Identifier, select "VB Script file" and enter the path of the runtimes.vbs file.  Running BgInfo from your startup folder keeps the information up-to-date.

'Script to print out the installed .NET runtimes in the system
set fso = CreateObject("Scripting.FileSystemObject")
set WSHShell = CreateObject("WScript.Shell")
windir = WSHShell.ExpandEnvironmentStrings("%windir%")
frameworkDir = windir + "\\\\framework"
if fso.FolderExists(frameworkDir) then
set installRoot = fso.GetFolder(frameworkDir)
set frameworkFolder = installRoot.SubFolders
for each f1 in frameworkFolder
' Look for folders that have the .NET runtime binaries or compilers in them
if fso.FileExists(f1 + "\\mscorwks.dll") or fso.FileExists(f1 + "\\clr.dll") or fso.FileExists(f1 + "\\csc.exe") then
end if
end if
set fso = nothing
set installRoot = nothing
set frameworkFolder = nothing

Pete Sheill : Customizing BgInfo to include the installed runtimes

No comments:

Blog Archive