title: Wix toolset: create directory in root disk (system disk or c:\) and copy files inside
body: <p>I'm aware of similar questions inside stackoverflow:</p>
  
  <p><a href="https://stackoverflow.com/questions/3296277/wixdefault-directory-in-wixui-installdir">WIX:default directory in WixUI_InstallDir</a>,</p>
  
  <p><a href="https://stackoverflow.com/questions/9390001/wix-installer-root-directory-and-versioning">WIX installer root directory and versioning</a>,</p>
  
  <p><a href="https://stackoverflow.com/questions/5269990/is-it-possible-to-have-two-root-directories-in-wix">Is it possible to have two root directories in WIX</a>,</p>
  
  <p><a href="https://stackoverflow.com/questions/9902980/wix-copy-file-to-custom-dir-in-another-partition">copy file to custom dir in another partition</a>, </p>
  
  <p><a href="https://stackoverflow.com/questions/10860731/how-to-create-a-directory-in-wix">How to create a directory in wix?</a></p>
  
  <p>however none of them shows a simple and immediate code to create a folder inside the C:\ folder (not hard coded but should be the root disk or system disk or whatever you would call the disk which contains the Windows folder) and to copy files inside it.</p>
  
  <p>In other words how can Wix create a C:\MynewDir\example.jar folder? </p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- WiX installer MyProgram by Mark Seuffert --&gt;
  &lt;?define ProductVersion = "13.1.2.3"?&gt;
  &lt;?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
      &lt;Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033"&gt;
          &lt;Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" /&gt;
          &lt;Media Id="1" Cabinet="product.cab" EmbedCab="yes" /&gt;
  
          &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
              &lt;Directory Id="ProgramFilesFolder"&gt;
                  &lt;Directory Id="INSTALLDIR" Name="MyProgram"&gt;
                      &lt;Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222"&gt;
                          &lt;File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" /&gt;
                      &lt;/Component&gt;
                  &lt;/Directory&gt;
              &lt;/Directory&gt;
  
              &lt;Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir"&gt;
              &lt;/Directory&gt; 
          &lt;/Directory&gt;
  
          &lt;DirectoryRef Id="ANOTHERLOCATION" FileSource="C:\MynewDir"&gt;
            &lt;Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111"&gt;
                      &lt;File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" /&gt;
                      &lt;CreateFolder /&gt;
              &lt;/Component&gt;
          &lt;/DirectoryRef&gt;
  
          &lt;InstallExecuteSequence&gt;
              &lt;RemoveExistingProducts After="InstallValidate" /&gt;
          &lt;/InstallExecuteSequence&gt;
          &lt;Feature Id="DefaultFeature" Level="1"&gt;
              &lt;ComponentRef Id="ApplicationFiles2" /&gt;
              &lt;ComponentRef Id="ApplicationFiles" /&gt;
          &lt;/Feature&gt;
      &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p><strong>EDIT 1:</strong>
   Yan Sklyarenko just found what I was looking for, that's the WindowsVolume (I don't know how I missed it inside <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa370905%28v=vs.85%29.aspx#system_folder_properties" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/windows/desktop/aa370905%28v=vs.85%29.aspx#system_folder_properties</a> microsoft document).</p>
  
  <p>However how do I replace FileSource="C:\MynewDir" with FileSource="[WindowsVolume]MynewDir" ??? because apparently even with WINDOWSVOLUME the resulting volume chosen is always D:\ in my computer which has more available space :( </p>
  
  <p><strong>EDIT 2</strong> I updated my code using Yan Sklyarenko's second sample ( @@@@newpart@@@@ identifies parts where code differs), however behaviour is still the same, the installer chooses the disk with more free space (D:\ in my case) and not C:\ where windows is..</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- WiX installer MyProgram by Mark Seuffert --&gt;
  &lt;?define ProductVersion = "13.1.2.3"?&gt;
  &lt;?define ProductUpgradeCode = "12345678-1234-1234-1234-111111111112"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
      &lt;Product Id="*" UpgradeCode="$(var.ProductUpgradeCode)" Name="MyProgram" Version="$(var.ProductVersion)" Manufacturer="COMPANY" Language="1033"&gt;
          &lt;Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" /&gt;
          &lt;Media Id="1" Cabinet="product.cab" EmbedCab="yes" /&gt;
  
          &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
              &lt;Directory Id="ProgramFilesFolder"&gt;
                  &lt;Directory Id="INSTALLDIR" Name="MyProgram"&gt;
                      &lt;Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222"&gt;
                          &lt;File Id="ApplicationFile1" Source="C:\Users\user\Desktop\myprogram.exe" /&gt;
                      &lt;/Component&gt;
                  &lt;/Directory&gt;
              &lt;/Directory&gt;
  
              &lt;Directory Id="ANOTHERLOCATION" FileSource="C:\MynewDir"&gt;
               @@@@newpart@@@@&lt;Component Id="ApplicationFiles2" Guid="12345678-1234-1234-1235-111111111111"&gt;
                      &lt;File Id="ApplicationFile2" Source="C:\Users\user\Desktop\InstallerFiles_13_4_9_3\myprogramLauncher.jar" /&gt;
                      &lt;CreateFolder /&gt;
                 &lt;/Component&gt;
              &lt;/Directory&gt; 
          &lt;/Directory&gt;
  
          @@@@newpart@@@@&lt;SetDirectory Id="ANOTHERLOCATION" Value="[WINDOWSVOLUME]" /&gt;
  
          &lt;InstallExecuteSequence&gt;
              &lt;RemoveExistingProducts After="InstallValidate" /&gt;
          &lt;/InstallExecuteSequence&gt;
          &lt;Feature Id="DefaultFeature" Level="1"&gt;
              &lt;ComponentRef Id="ApplicationFiles2" /&gt;
              &lt;ComponentRef Id="ApplicationFiles" /&gt;
          &lt;/Feature&gt;
      &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p><strong>EDIT 3</strong> The last code snippet above should work however change the casing of WINDOWSVOLUME to WindowsVolume as suggested.</p>