2017-06-10 02:38
浏览 16


I have a quick script that is scraping some data from a text file and outputting some summarized results to the user. When this is ran on windows by double clicking the executable it just runs real fast and closes the command prompt and the results of the program cannot be seen. I know I can go into command prompt and run it from there. But, is there anything I can do for when a user double clicks the .exe file to run it to keep that window open so results can be seen?

图片转代码服务由CSDN问答提供 功能建议

我有一个快速脚本,该脚本正在从文本文件中抓取一些数据并将一些汇总结果输出给用户。 当通过双击可执行文件在Windows上运行该文件时,它会快速运行并关闭命令提示符,并且看不到程序的结果。 我知道我可以进入命令提示符并从那里运行它。 但是,当用户双击.exe文件以运行该文件以使该窗口保持打开状态从而可以看到结果时,我能做些什么?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanpai1920 2017-06-10 02:53

    One trick is by waiting user input at the end of your application. Once user press any key, exit the application. The snippet:

    func main() {
        //Your original code...
        fmt.Printf("Press any key to exit...")
        b := make([]byte, 1)
    打赏 评论

相关推荐 更多相似问题