title: C# application searches System32 instead of local file
body: <p>I've developed a C# winforms application. The application requires another file to run, which is present in the same directory as the executable. Lets call this file <code>a.abc</code>. When I use command prompt, navigate to the program directory, and type the following to open a file with my program, it works fine:</p>
  
  <pre><code>my-prog.exe "path-to-file\file-name"
  </code></pre>
  
  <p>However, when I right click the file in explorer, go to open with, and select my program, the program for some reason tries to search for the file <code>a.abc</code> in the <code>System32</code> directory and not in the application directory.</p>
  
  <p><a href="https://i.stack.imgur.com/aqHPO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aqHPO.png" alt="enter image description here"></a></p>
  
  <p><strong>I know it will work fine if I use the complete file path instead of using the relative path, but I'm wondering why this is happening?</strong></p>
  
  <p><strong>UPDATE #1</strong></p>
  
  <p>I have a string resource named <code>reqdFileName</code> with value <code>toolset.f</code></p>
  
  <p>And I'm accessing the file using</p>
  
  <pre><code>using (StreamReader sr = File.OpenText(@Properties.Resources.reqdFileName))
      // read lines and use it here
  }
  </code></pre>