title: C++ getting the path of a file for System
body: <p>I have a project in JavaScript, it needs to be run with node and output to a file so I decided to use C++, I need to use the System command.</p>
  
  <p>I am using Visual Studio BTW</p>
  
  <p>I need to link to another files path in the .exe so the System command can use it. Example: If I have an exe that contains Generator/main.js, how can I get a path to it so the exe file is portable. How can I return the path of a contained file? Is this possible? </p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      cout &lt;&lt; "Generator!";
      cin.get();
      // This needs to be run from CMD, how do I link to Generator in the project folder?
      system("node Generator/main.js &gt; %userprofile%/Desktop/Gen.txt");
      return 0;
  }
  </code></pre>
  
  <p><strong>EDIT</strong> How can I copy files from an exe into a file, such as the desktop?</p>