How can I pass arguments to a batch file?

后端 未结 18 2166
陌清茗
陌清茗 2020-11-22 02:53

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file.

Here\'s what the command line looks like:

18条回答
  •  故里飘歌
    2020-11-22 03:25

    Make a new batch file (example: openclass.bat) and write this line in the file:

    java %~n1
    

    Then place the batch file in, let's say, the system32 folder, go to your Java class file, right click, Properties, Open with..., then find your batch file, select it and that's that...

    It works for me.

    PS: I can't find a way to close the cmd window when I close the Java class. For now...

提交回复
热议问题