Monthly Archives: January 2006

How To Import a Regfile? #VBScript

Tags :

Batch programmers know that reg files can be imported silently with Regedit.exe /S.

This example shows how to implement this in VBScript:

It is worth to use a Sub-procedure, especially if you have to import more than one regfile.

How To Determine The Name Of The Local Administrator Group? #VBScript

Category : VBScript

The VBScript below, LocalAdminGroup.vbs, determines the name of the local administrator group by searching its SID in the list of local groups.

See also: Well-known security identifiers in Windows operating systems

How to Call a VBScript Within a #VBScript?

There are two ways of calling a second script (another script file), each with its advantages and disadvantages…

Run method

If you don’t need to share code and/or variables you can call the second script using the Run method.

Though you can’t share variables you can use command line arguments in order to transfer information.

Using this method you can call a JScript file too.

ExecuteGlobal statement

You can read the second script into a variable and pass it to ExecuteGlobal. This enables you to share code and variables.

The procedure below loads the second script on the fly and executes it with ExecuteGlobal.

Imprtant notes:

1. This method complicates debugging if an error occurs in the second script because you will get the line number of the ExecuteGlobal statement in the first script.

2. The first and the second script share the same namespace. Therefore, watch for unique variable and procedure naming.