PDA

View Full Version : Batch Register .DLLs



klmag
12-23-2014, 08:41 AM
I have a folder with 130 .DLLs and I'm trying to register all of them with a simple call to command line but it isn't working due to the syntax, and I'm surprised I couldn't find this question anywhere on the forums using the search function.

Take a look here (https://www.simple-talk.com/blogs/2005/11/23/wild-card-registering-com-dlls/). In my project I have:

Run Command Line cd "%DirectoryToFolderWithDLLs%" && for %i in (*.dll) do regsvr32.exe %i /s

However I get a:
error GEN1006: Reference to variable %i in (*.dll) do regsvr32.exe % has not been previously defined.

Running this in command prompt, works fine, where && concats the two commands to be sent to the same command line session. I couldn't find whether or not there is an escape character I could use so the %i doesn't get processed as a compiler variable.

Since these files are already installed, and not a part of this installer--I broke a previous installer, oops!--, Install File with SelfReg isn't an option.

Maybe there is a better way to do this?

linder
12-23-2014, 09:34 AM
Hello,

The main problem is that cd "%DirectoryToFolderWithDLLs%" && for %i in (*.dll) do regsvr32.exe %i /s is not a valid command at all. The Windows APIs can't "process" it. Running a shell interpreter and Windows APIs are completely different animals.

What about 1) writing a small batch.bat file and then simply call that batch file from within your installer?

Another option 2) would be to use native Windows APIs functionality. For example, use the "Handle File Listing..." script function to build the list of DLLs to register. Then simply Loop through the list of files and let "Register File Operation..." register all your DLLs.

Both 1) and 2) should work fine.

Does this help?

Friedrich

klmag
12-23-2014, 10:31 AM
Implemented and tested perfectly with Handle File Listing. Great documentation in the .chm!

Thanks!

linder
12-24-2014, 03:13 AM
Perfect! Thank YOU !!!

Friedrich