繁体   English   中英

如何在Windows批处理文件中嵌入jar文件?

[英]How to embed jar file in Windows batch file?

我想做类似于Windows中的https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable的操作。

上下文:我正在编写一个protoc附件,该附件需要使用一个并且只有一个可执行文件。

我创建了一个具有以下内容的stub.bat文件:

@ECHO OFF
"C:\Program Files\Java\jdk1.8.0_161\bin\java" -jar %~dp0%0 %*

并遵循与Unix中类似的说明,但是在运行生成的批处理文件后,我看到:

Hello, World
'□' is not recognized as an internal or external command, operable program or batch file.

“你好,世界”表明我在做什么实际上正在起作用。 但是如何消除最后的垃圾呢?

stub.bat

exit /b

https://ss64.com/nt/exit.html

Syntax
      EXIT [/B] [exitCode]

Key
    /B        When used in a batch script, this option will exit 
              only the script (or subroutine) but not CMD.EXE

   exitCode   Sets the %ERRORLEVEL% to a numeric number.
              If quitting CMD.EXE, set the process exit code no.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM