title: Custom Protocol ( via Windows registry ) to open file in local folder and with default software
body: <h2>Please Read My Answer Below</h2>
  
  <p>I would like to open local files in their default software when clicking a HTML link ( in chrome ) by having a custom URI scheme defined in the Windows Registry.
  I have tried many different syntax for the registry rule definition and for the link I use.
     My default .reg file looks like this :</p>
  
  <pre><code>Windows Registry Editor Version 5.00
  
  [HKEY_CLASSES_ROOT\test]
  "URL Protocol"=""
  @="URL:test Protocol"
  "DefaultIcon"="\"C:\\Windows\\system32\\notepad.exe\",1"
  
  [HKEY_CLASSES_ROOT\test\shell]
  
  [HKEY_CLASSES_ROOT\test\shell\open]
  
  [HKEY_CLASSES_ROOT\test\shell\open\command]
  @="\"C:\\Windows\\system32\\notepad.exe\" \"%1\""
  </code></pre>
  
  <p>I've tried with every example I could find for the %1, %*, "%1" "%2" ...
  For now I'm just trying with notepad although eventually I would like to use explorer.exe for it to open the default software for the specified type of file.</p>
  
  <p>My HTML file is : </p>
  
  <pre><code>&lt;a href="test:C:test.txt"&gt;Open&lt;/a&gt;
  </code></pre>
  
  <p>I've tried test://C:[...], test:///C:[...], and with slashes and backslashes in the file path.</p>
  
  <p>With the 2 versions above, notepad opens but I get "The filename, directory name, or volume label syntax is incorrect." ( I put my file in the C drive root to be sure any special characters are avoided )</p>
  
  <p>Also, if I define the direct path to a file instead of a parameter string : @="\"C:\Windows\explorer.exe\" \"C:\test.txt\""  , the file opens without any problem.</p>
  
  <p>What am I doing wrong ? 
  Is there a way to see the String received as parameter ? </p>
  
  <p><strong>UPDATE</strong>
  I have modified the registry key to call a simple batch file ("C:\test.bat" %1) with an echo command to see the received parameter (echo %1 pause). By default the whole URI is passed ( e.g: "test:C:\test.txt" ).
  I've found that if I put a comma after the scheme, the batch file receives 2 parameters : %1="test:" &amp; %2="C:\test.txt".
  But the registry key value still needs to have "%1"... </p>
  
  <p>"%2" doesn't contain anything before it gets to the batch file. So sadly I can't directly call '"app.exe" %2' and need to call it from a .bat, I'll update if I find a solution.</p>