Windows隐藏的godoc

时间:2018-02-23 22:04:44

标签: windows batch-file godoc

我在启动隐藏在Windows开发机器上的godoc服务器时遇到问题。 我的想法是拥有一个启动godoc的批处理并在我的浏览器中打开它。 到目前为止工作,但我无法摆脱持有godoc输出日志的控制台窗口。 有没有办法在后台完全启动它?

我的批次:

#start cmd /c "godoc -http=:8080 -goroot=D:\Programmieren\Go\pkg > nul"
#start godoc -http=:8080 -goroot=D:\Programmieren\Go\pkg > nul
#Set oShell = CreateObject("Wscript.Shell")
#oShell.Run "godoc -http=:8080 -goroot=D:\Programmieren\Go\pkg", 0, true
start godoc -http=:8080 -goroot=D:\Programmieren\Go\pkg
start "" http://localhost:8080/pkg/

到目前为止,评论的内容是我尝试过的事情没有成功。

1 个答案:

答案 0 :(得分:0)

如果您确实想要使用命令运行cmd,则必须创建一个vbs文件以将该文件作为隐藏控制台进行调用。因此,创建一个名为hidden.vbs的文件并添加:

Set MyScript = CreateObject("WScript.Shell")
MyScript.Run "C:\path to batch\yourbatch.cmd", 0, False

其中C:\path to batch\yourbatch.cmd是批处理文件的路径。

您的批处理文件可以是这样的:

start "" godoc -http=:8080 -goroot=D:\Programmieren\Go\pkg && start "" http://localhost:8080/pkg/

然后运行vbs文件,该文件将静默调用批处理文件。