I'm trying to make a jar file association patch for a friend of mine, and when I test the batch file on my computer and try to launch a jar file, I get an error saying Unable to access jar file. But when I execute the instructions manually on the command prompt, the application launches perfectly. Am I doing something wrong here?

Here are the instructions I'm using:

ftype jarfile="C:\Program Files\Java\jre1.8.0_25\bin\javaw.exe" -jar "%1" %*
assoc .jar=jarfile

I just as a test wrote echo before each line to get an idea of what it was doing.

The %1 and %* are getting eaten up by the batch file as it replaces them with nothing. For Cmd like behaviour you need to use %%1 and %%*

Try %%1 and %%*


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.