title: How do I remove previous extension<->Program affiliations programatically?
body: <p>I would like to write a batch file which ensures that when a user clicks on a .JNLP file, it opens using javaws.exe (located in program files/java/... you know the drill)</p>
  
  <p>I have written the following batch file: </p>
  
  <pre><code>ASSOC .jnlp=JNLPFILE
  IF EXIST "%ProgramFiles% (x86)" (GOTO x86) ELSE (GOTO x64)
  :x86
  FTYPE JNLPFILE="%ProgramFiles% (x86)\Java\jre7\bin\javaws.exe" "%1"
  goto:eof
  :x64
  FTYPE JNLPFILE="%ProgramFiles%\Java\jre7\bin\javaws.exe" "%1"
  </code></pre>
  
  <p>I am testing this all in windows 7 64-bit.</p>
  
  <p>This... doesn't work.   Well, that's not entirely accurate.   It modifies the registry correctly, and it adds .jnlp to windows list of Recommended programs to run.  It does exactly what it should.</p>
  
  <p>But it doesn't solve my problem.   See, For testing, I went to Default Programs and associated .jnlp files with Notepad.   And when I try to open .Jnlp files, IT tries to open in notepad, even after my code has run.</p>
  
  <p>If I do an open with on a .jnlp, it gives me  the option to open with Notepad or javaws.exe   If I've run my code with the ASSOC, it adds a SECOND option of javaws.exe</p>
  
  <p>I've tried ASSOC .jnlp="" and FTYPE JNLPFILE=""  To try and clear notepad out, but had no luck.</p>
  
  <p>How do I make my batch file blow away prior settings and assert its dominance on the machine?</p>
  
  <p>EDIT:   Using the answers below, I have added a single command to the beginning of my batch file, which should take care of my problem and make things work correctly.</p>
  
  <pre><code>REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jnlp /f
  </code></pre>