Registering a DLL that has been previously registered

Hi all

does anyone know what happens in the following scenarios dealing with DLLs on Windows machines:

1. An existing DLL has been registered with Windows, I replace the physical .dll file and then register the new file again (note: no unregistering process first).

2. I attempt to unregister a DLL that is currently not registered with Windows.

Specifically, I am executing the commands below from a command prompt:

regsrv32 /s "path to dll" - register DLL
regsrv32 /s /u "path to dll" - unregister a DLL

I need to know if either scenario will fail (and return a failed error code to my batch file) or if it will succeed. Success in my case would mean:

1. New dll gets registered successfully (even though the old wasn't unregistered)
2. Command gets ignored since dll isn't registered

Ideally, the process is:

unregister existing dll
replace physical file
register new dll

The problem is that I may not be able to follow this ideal process from my code and that I could end up in a situation where I attempt to unregister a dll that was never registered or I attempt to reregister a dll without doing the unregister it first.

Any help is much appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Without unregistering the old dll you might orphan some registry information.

Just registering the new dll should create everything it needs to run properly so unregistering the old is unnecessary but would be cleaner if you could unregister the old first.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.