<p>Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me.  Now, if the file extension is registered (in Windows), I can do something like:</p>

<pre><code>Process.Start("Sample.xls");
</code></pre>

<p>However, I need to pass some command line arguments as well.  I couldn't get this to work</p>

<pre><code>   Process p = new Process();
   p.StartInfo.FileName = "Sample.xls";
   p.StartInfo.Arguments = "/r";  // open in read-only mode
   p.Start();
</code></pre>

<p>Any suggestions on a mechanism to solve this?</p>

<p><strong>Edit</strong> @ aku</p>

<p>My StackOverflow search skills are weak; I did not find that post.  Though I generally dislike peering into the registry, that's a great solution.  Thanks!</p>

[{'answer_id': 35928, 'author': 'Palgar', 'author_id': 3479, 'author_profile': 'https://Stackoverflow.com/users/3479', 'pm_score': 2, 'selected': False, 'text': '<p>If you query the registry, you can retrieve the data about the registered file type and then call the app directly passing the command line arguments.  See <a href="http://www.blackwasp.co.uk/ProgrammaticFileTypes.aspx" rel="nofollow noreferrer">Programmatically Checking and Setting File Types</a> for an example of retrieving shell information for a file type.</p>\n'}, {'answer_id': 35930, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 3, 'selected': True, 'text': '<p>Using my code from <a href="https://stackoverflow.com/questions/24954/windows-list-and-launch-applications-associated-with-an-extension#24974">this</a> answer you can get command associated with xls extension. Then you can pass this command to <code>Process.Start</code> method.</p>\n'}]
['https://Stackoverflow.com/questions/35914', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2258/']