![](/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.