Re-registering multiple DLL's with VB Script

Discussion in 'Programming & Software Development' started by Pookey, Apr 24, 2012.

  1. Pookey

    Pookey Member

    Joined:
    Dec 24, 2009
    Messages:
    1,861
    Location:
    Sydney
    Hey Guys,

    I was wondering if someone knew of a better way to re-register a bunch of DLL's that's not messy like what's below?

    Code:
    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run "regsvr32.exe c:\windows\system32\whatever1.dll"
    objShell.Run "regsvr32.exe c:\windows\system32\whatever2.dll"
    objShell.Run "regsvr32.exe c:\windows\system32\whatever3.dll"
    objShell.Run "regsvr32.exe c:\windows\system32\whatever4.dll"
    Ideally, I want something like this (messy quick version):

    Code:
    Sub RegisterMultipleDLL(RegisterDLLArray)
    Dim strDLL
    If IsArray(RegisterDLLArray)
    [INDENT]For Each strDLL in RegisterDLLArray[/INDENT]
    [INDENT]Some command to run regsrv32.dll /s with the appended name[/INDENT]
    Anyone able to point me in the right direction?
     
  2. OP
    OP
    Pookey

    Pookey Member

    Joined:
    Dec 24, 2009
    Messages:
    1,861
    Location:
    Sydney
    No-one has any ideas?
     
  3. Psychotria

    Psychotria (Banned or Deleted)

    Joined:
    Apr 26, 2012
    Messages:
    443
    I'm not sure. Wouldn't you just do (in the loop) objShell.Run "regsvr32.exe /s " + strDLL?

    (replacing regsvr32.exe with the full path if necessary)
     

Share This Page