Use Regasm From .bat

Posted on  by  admin
  1. Use Regasm From .bat 2

I’m lazy as any good admin should be. I don’t like having to search for information when I don’t have to. I especially don’t like searching for “that one EXE file I knew was here somewhere” or what syntax to use for that EXE file. This is why I create simple, little functions that may seem tedious and unnecessary at first. I create these functions to fit my brain. Whenever I need to do something I immediately think “What cmdlet would I look for?” and if it doesn’t exist I create it. Even if it’s to execute a 1-line EXE file.

Can I Use Entity/Use Codes in Sage 100 Sales Tax? You want to know if you can use entity use codes in Sage 100. Do we have to do anything with AvaTax if our license keys are changing in Sage 100? Create.bat file with this code: C: Windows Microsoft.NET Framework64 v4.0.30319 RegAsm.exe /codebase FULLPATHTODLLFILE Run this bat file as Administrator (Right-click - Run as Administrator, or run CMD line as admin and run it from there to see the results). Run the.bat “as Administrator”. Regsvr32 will be trying to create entries in the Windows registry, so it may need administrative privileges. On Windows 7, open an Administrator command prompt by going to the Start Menu, enter “cmd” in the search box and instead of pressing Enter, press Ctrl+Shift+Enter.

Use Regasm From .bat 2

In this instance, I have the function called Register-File. The only real thing this does is execute regsvr32.exe /s $SomeFile and ensure $SomeFile exists. It may sound foolish but I can never seem to remember the exact syntax plus I always seem to fat-finger the file somehow, watch it error and try again. All I have to do now is type Register-File with the file name and be done. Register-File is a lot easier to remember that regsvr32.exe /s, right?

STOP! Quit reading this article and start writing your own to attract more readers and learn how to get paid for them! In my latest eBook, Teach Me: How to Write How-to Technical Articles that Make Money, I uncover all of the tips and tricks I've learned over the years to create better articles to build a 50K user/month blog and generate over $200,000!


Now back to your regularly scheduled blog post...

P.S. Another good way to prevent having to remember syntax is Powershell aliases. Perhaps I’ll leave that one for another post.