views:

899

answers:

1

I have a C# program that needs to spawn a .BAT command file during its execution. No problem. I can just use (for example)...

System.Diagnostics.Process.Start("PublishFeed.bat", "file.xml");

...in order to run the cmd with a parameter. In the debugger, this works fine. However, when I run the executable in production, Windows pops up a dialog box that says "Do you want to open this file? Name: PublishFeed.bat Type: Unknown File Type.

If I click OK, it runs fine.

Why is this dialog appearing? Seems especially odd for it to claim Unknown File Type, when clicking OK seems to run the BAT file with no problem.

thanks all!

P.S. Yes, I can probably remove the need for the BAT file, but I would still like to understand the issue.

+3  A: 

I think the most reliable way to do this is to just speficy to open that batch with cmd:

System.Diagnostics.Process.Start("cmd /c", "PublishFeed.bat file.xml");
Joey