java - 是否可以在 Windows Powershell 脚本中嵌入 jar 文件?
问题描述
当我有一个 jar( hoge.jar
) 文件、一个 unix shell 脚本( hoge.sh
) 或一个 windows 批处理文件( hoge.bat
) 时,我可以使用下面的 jar 文件获取它们:
cat hoge.sh hoge.jar >foo.sh
或者
copy /b hoge.bat+hoge.jar foo.bat
有没有办法用 powershell 脚本(hoge.ps1
)
copy /b hoge.ps1+hoge.jar foo.ps1
至于如上foo.ps1
得到的,
java -jar foo.ps1
确实有效,但powerscript的一部分永远不会运行......(当用作powerscript时)
解决方案
您可以将任何文件存储在 powershell 脚本中。这是一篇优秀的文章,向您展示了如何使用 base 64 编码。
推荐阅读
- c++ - 所有字符串均未识别
- c++ - WIC 的 JPEG 解码问题
- php - 如何使用 laravel 查询生成器在一个选择中获取预订集合
- java - 如何使用符合我的条件的 Mongodb Core Query API 选择字段
- python - ModuleNotFoundError:没有名为“allauth.accountallauth”的模块
- python - python检查字符串是否可打印
- javascript - 如何修复“AttributeError:'WebElement'对象没有属性'find_element_class_name''?
- gradle - 从单个 src/main/java 文件夹创建多个库 [每个用于一个包]:GRADLE 项目
- json - 如果列表在数组中,如何在 SwiftUI 中为每个口袋妖怪名称制作类型列表?
- javascript - 如何在 asp.net 核心中使用 jquery 下载文件?