How to create auto-installer to register DLL on user Windows PCs

I need to find the most elegant solution for auto-installing a DLL (including registering it) on a user's PC. This would be invoked thorugh the user clicking a link (e.g. myDLL.exe).

All the target systems will be Windows: NT, 2000, XP or Vista.

I've looked at a few open source installers (like SEAU) and don't have time/budget to get InstallShield or Wise today. Is there a way perhaps using Microsoft SDK that's straightforward, or creating an MSI?

This particular issue is a brand new foray for me, so go easy :)

KC.
TangoGirlAsked:
Who is Participating?
 
RubenvdLindenConnect With a Mentor Commented:
With PowerArchiver (http://www.powerarchiver.com), you can turn a zip file to a self extracting exe file and specify a command to run after the extraction, e.g. the install.bat I created for you. This is very easy for your customers.

Other zip programs (like WinZIP) probably have the same kind of functionality.
0
 
RubenvdLindenCommented:
An easy and cheap way is to create a small batch file to do the job.
In the next example, I will copy your DLL to the Common Files\TangoGirl (probably in C:\Program Files) folder and register it:


@echo off
md "%CommonProgramFiles%\TangoGirl"
copy myDLL.DLL "%CommonProgramFiles%\TangoGirl"
regsvr32 "%CommonProgramFiles%\TangoGirl\myDLL.DLL"


Save this file as install.bat and copy it to the installation directory where your DLL resides.
Now just run it to install.

I hope this helps!
0
 
zcrammondCommented:
your best bet and by far your easiest bet is a simple batch file:

dll installer.bat
xcopy "<location of dll>" "<location you want the DLL to be in" /y /r
regsvr32 "<location of dll which has been copied>"

replace <location of dll> with the source location (a shared location on a network or within the same directory the bat file will run from)

replace <location you want the dll to be in> with the destination of the dll (system32 directory)

replace <location of dll which has been copied> with the same location as above

This will copy the dll to whichever location you want it to go to and then register it

EXAMPLE:

xcopy "\\server1\dll\mydll.dll" "c:\windows\system32\" /y /r
regsvr32 "c:\windows\system32\mydll.dll!"

0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Alan Huseyin KayahanCommented:
   Hi TangoGirl
         Create a folder and copy the dll into it. Lets say that its xxx.dll
         Create a batch file with following commands in it

         copy xxx.dll c:\%windir%\system32
         regsvr32 xxx.dll

        As you double-click that bat file, dll will be installed and registered. You can share that folder and install from other clients

Regards
       
0
 
zcrammondCommented:
lol ruben, you beat me to it!!
0
 
RubenvdLindenCommented:
LOL, indeed! But it's nice to know everyone agrees with me ;-)
0
 
TangoGirlAuthor Commented:
sounds along the right lines... but how would I make this available via a web page - i.e. I can't link to the .bat file
0
 
TangoGirlAuthor Commented:
..oops :)

I was assuming that you can't just link to a .bat file from a hyperlink?

KC.
0
 
RubenvdLindenCommented:
Can you zip the file and offer it as a download on your website?
0
 
zcrammondCommented:
you will be able to link to the bat file, it will prompt the users to download the file and open it, once opened it will run.

So you will need to make sure that wherever the users will be downloading the bat file to, they will be able to access the UNC path when it opens :)
0
 
RubenvdLindenCommented:
It works in an intranet environment; if the product is intended for external customers, your best bet is to offer it as a zip file.
0
 
TangoGirlAuthor Commented:
I'm trying to make it as easy as possible for our non-tech customers. So thought exe was the best bet, rather than giving complex install instructions. WIll run some testing on the BAT now - cheers guys.
0
 
TangoGirlAuthor Commented:
I thought about a self-extracting file, but was missing the BAT bit :) Thanks Ruben will give this a try.
0
 
TangoGirlAuthor Commented:
So... just to recap so I understand the process...

- create batch file with install commands
- create self-extracting archive containing DLL & BAT (with instruction to run BAT after extracting)

KC.
0
 
RubenvdLindenCommented:
That is correct.
0
 
TangoGirlAuthor Commented:
just literally: run install.bat ?
0
 
TangoGirlAuthor Commented:
it'll have to be relative, right, so how will i determine the correct variable for common program files - i.e.

run %CommonProgramFiles%??\myinstall_directory\install.bat

i think i'm nearly there...!
0
 
RubenvdLindenCommented:
Most self-extractors automatically assume that the working directory of the program to run should be the directory where the files are to be extracted. In that case, running install.bat should be enough to get things done.

If it doesn't, there is probably a simple solution:
You should be able to specify a default output directory for the self-extractor. Specify %TEMP%
Now, change the copy statement in install.bat like this:

copy "%TEMP%\myDLL.DLL" "%CommonProgramFiles%\TangoGirl"


I hope this helps
0
 
TangoGirlAuthor Commented:
that's could be a solution i think, as it's having a problem running the command following extraction.

My other issue is not having admin rights to the program files dir of my own machine, which I can safely assume will also happen with lots of my users.

So I'm going for c:\myinstalldir\ instead. Do you foresee any issues with this? And is there a more elegant way of referencing this using environment vars, as I realise hard-coding c: is a risky strategy?
0
 
RubenvdLindenCommented:
You could use %SYSTEMDRIVE% to find the disk where Windows resides.
I would recommend %USERPROFILE% though (this will return e.g. C:\Documents and Settings\TangoGirl).
However, installation without (at least some) admin rights is not possible. You might be able to copy the file to a user folder, but REGSVR32 really requires admin rights to register your DLL.
0
 
TangoGirlAuthor Commented:
yes - I've just come a cropper with this one ;) Can only get as far as REGSVR32 and then that's it.

I don't think there's away around this..nnnggg!
0
 
RubenvdLindenCommented:
The only thing you can do is to put an instruction on your website that the installation can only be performed by a system administrator or a user with administrative rights on the computer.

That way you can also specify the Common Files folder again, which is better. Come to think of it, it's not wise to store the DLL in a user folder; that way it will not be accessible for other users of the computer.
0
 
TangoGirlAuthor Commented:
Yes fair comment, did cross my mind.

Thanks Ruben you've been incredibly helpful :)

KC.
0
 
RubenvdLindenCommented:
Your welcome, I'm glad I could be of help!
0
 
TangoGirlAuthor Commented:
related topic, & cheeky I know as I shoudl start a new q - but do you know of a simple way of determining whether the user has admin rights over their machine?

 I'm devising a test to determine this before I run the EXE to try to handle user experience a little better.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.