Last active
October 6, 2016 18:39
-
-
Save thephilip/7287099159105d3ef516617ee56690db to your computer and use it in GitHub Desktop.
Java JNLP File Association Fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
color e9 | |
goto :CHECKPERMS | |
:RUN | |
:: Kill all IE processes | |
taskkill /f /im iexplore.exe /t >nul 2>&1 | |
ping -n 1 127.0.0.1 >nul 2>&1 | |
:: Check system arch | |
if %processor_architecture% == x86 ( | |
ftype JNLPFile="c:\program files (x86)\java\jre7\bin\javaws.exe" "%1" | |
assoc .jnlp=JNLPFile | |
) else ( | |
ftype JNLPFile="c:\program files\java\jre7\bin\javaws.exe" "%1" | |
assoc .jnlp=JNLPFile | |
) | |
:: Clear IE cache, cookies, download history, and tracking protection (respectively) | |
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 | |
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2 | |
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16384 | |
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2304 | |
:: Clear Java WebStart applications and cache | |
javaws -uninstall >nul 2>&1 | |
ping -n 1 127.0.0.1 >nul 2>&1 | |
goto :END | |
:CHECKPERMS | |
echo Detecting permissions... | |
net session >nul 2>&1 | |
if %errorLevel% == 0 ( | |
goto :RUN | |
) else ( | |
color 47 | |
echo Please re-run this script with Admin permissions. | |
pause | |
goto :END | |
) | |
:END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment