Will doing "Run as administrator" on a .BAT file allow regsvr32 enough privlieges to register a DLL or OCX?

The .bat file contains:

regsvr32 -u SomeOCX.ocx
regsvr32 SomeOCX.ocx

Or, does the logged in user need to be an administrator?


"Run as administrator" should provide sufficient permissions if the user account can use that function.

| improve this answer | |
  • When would a user account not be able to use a function? – CJ7 Jun 4 '10 at 8:11
  • @Craig Johnston If the account is not an administrator, and if the user does not know the name and password of an administrator account, they will not be allowed to run applications as an administrator. If the account is not an admin account, they will be asked for valid credentials with which to run the .bat file. – Darth Android Jun 4 '10 at 13:56

There can be difficulties with running .BAT files if you need it to run with administrator access. If right-clicking on the .bat file and choosing run as administrator doesn't work, then try starting an elevated command prompt and running the .bat file from there.

| improve this answer | |

Even if run from an account with administrator privileges (except for The built-in administror account), you will still need to use "run as administrator" to elevate the batch file, because of UAC restrictions. If you will be distributing this batch file or just want to make the process automatic, you may want to check out the Elevation powertoy, which lets you put lines in a batch file to cause it to be automatically elevated and prompt the user accordingly.

| improve this answer | |
  • How do domains affect this? Is there the possibility that "Run as administrator" will elevate to domain-administrator and not local-administrator? – CJ7 Jun 6 '10 at 6:44
  • It will elevate to whatever account you choose. When a computer is a member of a domain, the UAC credentials dialog will prompt you for a username and password; you can choose a local or domain administrator. – nhinkle Jun 6 '10 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.