dptrmt4366 2014-09-11 12:00
浏览 74
已采纳

通过下拉菜单运行Go脚本时防止.bat文件关闭

I have this little Hello World program written in Go:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world
")
}

I use Sublime Text 3 with GoSublime. Something misconfigured, because Tools -> Build command not working, just only when I type in the console:

go build

Then the editor creating the .exe program.

So I want to use a basic .bat file, where I drag and drop my hello.go program:

@echo off
cd /d "%~dp0"
start "" "C:\Go\bin\go.exe" "run" "%~f1" pause

It runs without problem, but unfortunately closes when it's finished.

Can You help to solve this? ;)

  • 写回答

1条回答 默认 最新

  • dousi8559 2014-09-11 12:07
    关注

    It's just that start launches it in it's own process?

    so:

    @echo off
    cd /d "%~dp0"
    C:\Go\bin\go.exe run %~f1 
    pause
    

    Should work?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效