Coder Social home page Coder Social logo

launcher's Introduction

Table of contents generated with markdown-toc

一个 go 编写的启动器

改名

将 versioninfo.json.bk 更名为 versioninfo.json 并修改相关配置

图标配置IconPath

执行权限配置ManifestPath

举例添加管理员权限

ManifestPath: "nac.mainfest"

nac.mainfest 中内容为

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
 <security>
     <requestedPrivileges>
         <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
     </requestedPrivileges>
 </security>
</trustInfo>
</assembly>

编译

# 生成syso文件,使生成的exe带详细信息(目标为linux下可执行文件时可忽略此步骤)
go generate
# 生成不带控制台的启动程序
go build  -ldflags="-H windowsgui"

launcher.json 默认会打包进生成的二进制文件,如果想使用外部配置文件,需要手动复制launcher.json到程序所在目录,外部的launcher.json优先级较高

配置

启动配置依赖于launcher.json

{
  "target": "ping", // 可以替换为java、./xxx.exe 等参数
  "workDir": ".", //工作目录
  "params": ["www.baidu.com", "-n", "2"] // 参数数组
}

程序支持将命令行参数透传添加到 params 后

示例: 配置修改为

{
  "target": "ping",
  "workDir": ".",
  "params": ["www.baidu.com"]
}

编译后执行 ./launch.exe -n 2和默认配置有相同效果

launcher's People

Watchers

James Cloos avatar tsvico avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.