My Software Notes

Useful things I discover

Archive for the ‘Tools’ Category

ISO Mounting Software

leave a comment »

If you are running Windows 8 then mounting ISO images is built in.

If you are running an earlier Windows version then you need software.  The simplest I’ve found is Virtual CloneDrive.  There are others that people seem to like, such as MagicISO and DaemonTools, but you aren’t supposed to install their free versions for commercial use, but Virtual CloneDrive is completely free and works great.

BTW: Don’t even think of using Microsoft’s Virtual CDRom Control Panel – it works on XP, but not on anything later without jumping through so many hoops that your legs will give way.

Written by gsdwriter

July 1, 2013 at 2:22 pm

Posted in Tools

log4net – Quick and Dirty set up

leave a comment »

I do this infrequently enought that I have to keep going back to old projects to see the steps.  So, I’m putting them here to save me the hunting.

  1. Use NuGet to pull in the Log4Net binaries, etc. to your project.
  2. Add to your web.config <configSections> element:
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
  3. Add to your web.config under the root <configuration> element (modify the appender as you wish):
      <log4net threshold="All">
        <appender name="LogFile" type="log4net.Appender.FileAppender" >
          <file value="c:\logs\MyLog.log" />
          <appendToFile value="true" />
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date %-5level %-40logger{2} - %message%newline" />
          <level value="All" />
          <appender-ref ref="LogFile" />
  4. Add to your AssemblyInfo.cs file:
    [assembly: log4net.Config.XmlConfigurator(Watch = true)]
  5. In the file where you want to use it:
    using log4net;
  6. Example of use:
    var log = LogManager.GetLogger(System.Reflection.MethodBase
    log.Error("This is a test log message with an exception", 
        new Exception("Test Exception"));

That should do it.

Examples of config: log4net Config Examples

Written by gsdwriter

January 31, 2013 at 1:07 pm

Posted in .NET, Logging, Tools

Replacing Notepad.exe

leave a comment »

You want to use your favorite text editor rather than Notepad.  It seems like you could just rename the exe of your favorite to “notepad.exe” and drop it into the Windows directory.  But it won’t work.

First your favorite text editor may not be composed of just one exe file.  Second Windows regards Notepad as part of its installation and Windows Protection will overwrite your text editor at some point.

But there is a way to do it and here it is:

(I’m using Notepad++ as my example text editor. You can alter the various paths and file names to suite your own situation.)

1. Create a cmd file containing these two lines:

@echo off 
start "" "C:\Program Files (x86)\Notepad++\notepad++.exe" %2 %3 %4 %5 %6

Save it in the Notepad++ folder. Call it npplauncher.cmd

2. Open regedit and navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\

3. Add a key under “Image File Execution Options”. Name the key “notepad.exe”.

4. To the key add a string value with the name “Debugger” and the value “C:\Program Files (x86)\Notepad++\npplauncher.cmd”.

That should do it.  Now just double-click a txt file or type “notepad myfile.txt” at the command line and your text editor will open instead of Notepad.


Q: Why do we drop %1 in the cmd file? 

The command line you use when you attempt to run your text editor will look something like “notepad myfile.txt”.  This entire command line is passed to npplauncher.cmd and the first parameter will be “notepad”, which you don’t want to open in your text editor, so we drop it.

Q: Why do you have an empty string as the first parameter to the start command?

If the first parameter to start has quotes around it then start treats it as the title of the window that it will open.  If you omit the empty string then “C:\Program Files (x86)\Notepad++\notepad++.exe” will be treated as a title and not as a program to run.  Here is where I found this:

Q: Why do you put the editor’s name into the “Debugger” string value?

It launches the application you’ve named as the debugger for the application named in the key.  I.e., “C:\Program Files (x86)\Notepad++\notepad++.exe” is regarded as the debugger for “notepad.exe”.  For a much better explanation see this: Replacing Windows Applications – the Safe Way.

Q: Why do I need the npplauncher.cmd file?

You can get around it if your editor has a way for you to ignore the first parameter.  The only reason for the cmd file is to ignore that first parameter.  See the “Replacing Windows Applications – the Safe Way” article I linked to ealier for details.  I guess another reason for the cmd would be if there are other things you want to do to the command line before passing it on to the text editor, e.g., for Notepad++ you could add the -multiInst parameter.

Q: Why do you have %2 through %6 in your cmd file?

I just decided to pass up to 5 parameters.  If you want more then add more.  If you want to get really fancy then you can probably find some crazy DOS command that will allow you to pass the entire command line minus the first parameter.

Q: I use Notepad++ and I want to use the -multiInst parameter.  How do I do that?

Just put -multiInst before the %2 in the cmd file.

start "" "C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst %2 %3 %4 %5 %6


So that’s it.  Pretty easy really, once you know.

Other references:


Written by gsdwriter

July 11, 2012 at 3:11 pm

Launch a Powershell console with Administrator rights from a Powershell console without Administrator rights

leave a comment »

That title is a mouthfull, but the good news is that the Powershell command to do it takes less characters.

It’s really simple once you have hunted around on the net for a while:

Start-Process "$psHome\powershell.exe" -Verb Runas

That’s it.

Open a regular PS console and type that.

I’ve only tried it on my own machine where I am an admin and I have UAC turned on. When I try it I get the UAC prompt, followed by a nice PS admin console.

I got it from this: Re-launch Powershell Script Elevated


This is bad, but I couldn’t resist it.  I’m a big fan of “Young Frankenstein“, one of the funniest movies of all time,  and there is a joke in it about “elevate me” (go to this page and search for “elevate”), so I created the “Elevate-Me” function:

function Elevate-Me ()
    echo "Inga:            ""Now? Right here?"""
    echo "Dr Frankenstein: ""Yes, yes.  Raise the platform"""
    echo "Inga:            ""Oh. Ze platform. Oh, zat, yah, yah ... yes"""
    Start-Process "$psHome\powershell.exe" -Verb Runas

Just add it to your profile and let the elevating begin 🙂

BTW: I know “Elevate” is not an approved verb, but it’s worth it for the homage to the brilliance of Mel & Gene (and Teri).


Written by gsdwriter

April 20, 2012 at 8:00 am

Posted in Humor, Powershell, Tools

How to Unit Test Custom Data Annotations

with one comment

I created a custom data annotation to test a zip code and I started writing a unit test to make sure it worked and … ehhh, ummm, arrr?? How do I test it?

Well, I searched and found this great article: Unit Testing Custom Data Annotations.

Thank you Walter C. Johnson! A nice clean solution.

Written by gsdwriter

December 16, 2011 at 5:42 pm

Posted in .NET, Testing, Tools

Tagged with ,

Internet Explorer Developer Tools Not Visible

with one comment

I know that software has to be gotten out and on time, thus we have to triage bugs and sometimes leave a bug in a product because it doesn’t crash it and there is a workaround, but I don’t agree with leaving this one in IE8 Developer Tools.

Here’s the story: 

I try to open the IE8 Developer Tools (F12 or “Tools > Developer Tools”) and nothing happens.

I hunt around and find that the app appears in the taskbar and in the Alt-Tab list but when I select it, nothing happens.

I Google the issue and find this IE 8 Developer Tools not working In Windows?

Some of the suggestions don’t work.  Here is what worked for me in Windows 7:

  1. Select IE in the taskbar
  2. Right-Click on the Developer Tools icon and select “Maximize”
  3. Click on the title bar and pull the app down so that it changes its size to a non-maximized window (It doesn’t work to double-click the title bar, it just minimizes again)
  4. Now close the tools and close IE8
  5. When you open IE8 again open the tools and the app should be a window and not minimized.
  6. I had to do this a few times to get it to work so it’s possible step 4 should be “close IE8 and then close the tools”.

If you find that the tools are somehow off your screen then try this:

  1. Select IE in the taskbar
  2. Select the tools app
  3. Press Alt-tab and then “M” (this opens the application menu and activates “Move”.
  4. Use your keyboard arrow keys to move the app into view.
  5. I haven’t had that problem with the tools, but have with other applications

Sheesh!  What a pain in the butt!

If Microsoft wants to persuade web developers that IE is not the anti-Christ they are not going about it in a very smart way.

Written by gsdwriter

November 18, 2010 at 6:14 am

Posted in Rant, Tools, Web Development

Assembly Version/Fully Qualified Name from the Command Line using PowerShell

with 2 comments

I was logged into a server core installation of Windows Server 2008 and I wanted to get some details on an assembly file.  But how to do it from the command line?

I found this article by good ole Scott Hanselman: Output an Assembly Version/Fully Qualified Name from the CommandLine which is great if I could have compiled the C# console program and copied it over, but I couldn’t due to various security issues.  So instead I wrote the same thing in PowerShell.

It’s not particularly difficult, but it may save someone out there some time.  Put this into a ps1 file:

    $asmFile = $(Throw "Assembly Filename is required")
$asm = [System.Reflection.Assembly]::LoadFrom($asmFile)
echo $asm.FullName

And the output is something like:

ps: .\AssemblyFullName.ps1 "Reminder.exe"
Reminder, Version=, Culture=neutral, PublicKeyToken=null

Tell me if you finds this helpful.

Written by gsdwriter

July 12, 2010 at 1:06 pm

Posted in Tools