title: Update context menu of all file extensions in Windows via powershell takes long time
body: <p>Developing our own application for our company only, we have developed script used for installation from shared drive. Except the installation itself, the script should also create/update values in the registry of particular user (<code>HKEY_CURRENT_USER</code>).</p>
  
  <p>These values are separated for:</p>
  
  <ul>
  <li>Directories (<code>HKCU:\Software\Classes\Directory</code>)</li>
  <li>All File Extensions (<code>HKCU:\Software\Classes\*</code>)</li>
  </ul>
  
  <p>For the directory folder the update is immediate, where for the extensions it seems to take quite some time depending on machine hardware (from 40 sec to 2 minutes).</p>
  
  <p>Now there is a trouble to create "entry" in the registry for the folder named <code>*</code> only. I've got a question for this to resolve (<a href="https://stackoverflow.com/q/48786037/7167572">PowerShell: How do I create selector on file/folder, whose name is &#39;*&#39; (asterisk/star)?</a>).</p>
  
  <p>Ignoring the issue above, we have found some solution how the <code>string path</code> works, however I'm not sure what is happening behind the code and do not understand why it takes so long time.</p>
  
  <pre><code># Directory
  New-Item -Path "HKCU:\Software\classes\Directory" -Name "shell" | Out-Null
  # All Files Extension
  New-Item -Path "HKCU:\Software\classes\[*]" -Name "shell" | Out-Null
  </code></pre>
  
  <p>One idea is that the <code>[*]</code> solution actually goes through all the file extensions, but the registry itself is showing this <code>NewItem</code> under <code>*</code> folder and not shown under particular extensions:</p>
  
  <p><img src="https://i.stack.imgur.com/mtx26.png" alt="Registry screenshot"></p>
  
  <p>Another idea about this, is when we have a registry file (<code>*.reg</code>), by running the file the registry entry is added immediately and resolve the case.</p>
  
  <hr>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>What is actually happening when we are running the query to add entry under <code>[*]</code> selector?</li>
  <li>How can be this process optimized to lower the time for creating new folder in registry for all files' extension?</li>
  </ul>