0

Is there a way to set a jar to behave like a regular batch file in windows, meaning that i only have to type MyJar param1 param2 instead of java -jar MyJar.jar param1 param2 ? I am looking for a global solution that i only have to setup once, not a Jar Specific solution such as creating a batch file for every jar i wish to run. Thanks in advance

sh7411usa
  • 196
  • 1
  • 13
  • You're looking to create an alias. This will help: https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt – Alon Gadot Mar 29 '20 at 08:38
  • thanks! though it seems from a quick look that that will still require a command before the name of the jar for instance if i make `jj` an alias for `java -jar` istill have to type it before the jar filename. im looking for something more like i noted in my question – sh7411usa Mar 29 '20 at 08:52
  • You could set the alias to include a file name or even your parameters. For example: DOSKEY jj=java -jar path-to-my-jar\MyJar.jar – Alon Gadot Mar 31 '20 at 09:35
  • @alon gadot. toda. it will still be a jar specific solution, meaning ill need a separate alias for each jar, or ill need to preface each jar with the alias. there must be a way to just have cmd learn how to handle jar files internally – sh7411usa Mar 31 '20 at 10:10

0 Answers0