![](/img/trans.png)
[英]Is it possible to embed a jar file in a Windows Powershell script?
[英]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.