Executing .class files on Windows with a double click or right click
Use the Windows Explorer Tools|Folder Options|File Types menu to add this command line for a .class file:
Change the path and folder to where you put the ExecClass.bat file.
The ExecClass.bat file:
The trick here is that the %~n1 variable returns the filename only. The java command doesn't like the .class extension which you would get with the normal %1
REM Execute a java class file - need to strip extension
echo filename is %~n1