title: VS2010 debugging with command-line arguments
body: <p>I've set the command line args for my app in the <code>project properties -&gt; debugging -&gt; command arguments</code> section.</p>
  
  <p>If I run the program from command line directly I do:</p>
  
  <p><code>progname arg1 arg2</code></p>
  
  <p>So I've set the command line arguments in VS to </p>
  
  <p><code>arg1 arg2,</code></p>
  
  <p>as described <a href="https://stackoverflow.com/questions/298708/debugging-with-command-line-parameters-in-visual-studio">here.</a></p>
  
  <p>But, the program doesn't seem to run the same way as in running it from command line. The arguments are text files, and in the command line it can load those text files correctly, in VS2010 it doesn't somehow. Any ideas why? </p>
  
  <hr>
  
  <p><strong><em>Edit: update/clarification of post:</em></strong></p>
  
  <p>I am not getting any exceptions.</p>
  
  <p>I may have oversimplified the problem too much in my explanation. I'm not actually loading text files, I'm loading a physics engine, which should be determined at runtime, so I need command line arguments.</p>
  
  <p>The code used for loading the physics engine, on a high level, is:</p>
  
  <pre class="lang-cs prettyprint-override"><code>if ( argc > 2 )
  {
      #ifndef PAL_STATIC
          PF->LoadPALfromDLL(); 
      #endif
          //DebugBreak(); // for debugging ;)
          PF->SelectEngine(argv[1]);
  
          if (!pp) {
      #ifdef _WIN32
              MessageBox(NULL,L"Could not start physics!",L"Error",MB_OK);  
  
           /* ^ This is the error I am getting, i.e. pp is NULL, 
           so "PF->SelectEngine(argv[1]);" is not loading engine correctly */
  
      #else
              printf("Could not start physics engine %s!\n",argv[1]);
      #endif
  
      return -1;
  }</code></pre>
  
  <p>I am using Bullet, which is run like this: </p>
  
  <pre><code>progname.exe arg1 arg2, 
  </code></pre>
  
  <p><code>arg1</code> is the physics engine name and <code>arg2</code> is a physics file to load, but it hangs on <code>arg1</code>. </p>
  
  <p>The specific way I invoke this on the command line is: </p>
  
  <pre><code>progname.exe Bullet filename. 
  </code></pre>
  
  <p>If i do this on command line it works, but if I pass these arguments to the debugger, I get a problem saying <code>could not load physics engine</code>.</p>
  
  <p>This may be a result of the internals of the physics engine loader, which is from another source, but my guess is that this should work the same way whether I pass these arguments in the command line or in the debugger settings of VS.</p>
  
  <p>I will look into the UAC settings and see what they say.</p>