c# - 在 MACOS 中将参数传递给“打开”命令
问题描述
我在 .NET Core 中有一个应用程序,我必须使用脚本运行它。首先,我认为我必须拥有虚拟 Windows 才能打开我的应用程序的几个实例。我有带有该命令的 bat 脚本:
start ./Host/bin/Release/netcoreapp3.1/win-x64/Host.exe "./CONFIG/host1.json"
现在我发现我可以使用命令创建 OSX 可执行文件:
dotnet publish -r osx-x64 -c Release
所以现在我可以使用 Macos Terminal 启动应用程序了
open ./Host/bin/Release/netcoreapp3.1/osx-x64/Host --args "./CONFIG/host1.json"
但是我必须将参数传递给主应用程序,并且 open 命令不想通过我的字符串传递。
我试过open -a Terminal ...
or ... --args './CONFIG/host1.json'
。
我的主机应用程序已打开,但 main 中的 args[0] 为空。
如何正确传递我的字符串参数?
解决方案
推荐阅读
- javascript - UnhandledPromiseRejectionWarning:MongoError:无法使用已结束的会话
- javascript - 如果条件为真或假,我们可以在组件内传递三元表达式并作为道具发送吗
- html - 无法部分返回从标题生成的图像 - Hugo
- html - 1 多个播放器的音量控制器?
- raspberry-pi - bluetoothctl 不显示蓝牙低功耗 (BLE) 设备
- bash - bash 导出未包含在 kubectl 命令中
- python - Flask Python 如何将输入从文本框传递到 POST 请求?
- r - 带有 facet_wrap 的 cowplot::plot_grid - y 轴标题与轴标签重叠
- python - 如何以这种方式平铺张量?(张量流)
- php - TCPDF - 在输出中使用比例数字