I have no idea why you want to do such a thing, but I found where you got that code from and followed ALL OF THE INSTRUCTIONS with the code snippet and it worked just fine.
I'm guessing you either skipped adding the COM reference to the "Microsoft Shell Controls and Automation" library, probably because you didn't understand what that meant, or you didn't follow the instruction to add the [STAThread] attribute to the method you made the call to FileRun() in.
using System;
namespace CsSandbox
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Shell32.Shell shell = new Shell32.Shell();
shell.FileRun();
}
}
}
You can add the reference by going to the Solution Explorer in your project, right-clicking the References item, and select "Add Reference..." In the dialog that comes up, click on the COM item on the left side of the dialog, then scroll down the long list of COM libraries that is displayed until you find "Microsoft Shell Controls and Automation". Hover the mouse on that item and check the checkbox next to it. Click OK and you're done.