Windows 隐藏的 godoc

Windows hidden godoc

我在启动隐藏在我的 windows 开发机器上的 godoc 服务器时遇到问题。 这个想法是有一个启动 godoc 并在我的浏览器中打开它的批处理。 到目前为止,这是可行的,但我无法摆脱保存 godoc 输出日志的控制台 window。 有什么方法可以完全在后台启动它吗?

我的批次:

#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/

注释行是我到目前为止尝试过但没有成功的东西。

如果您真的想 运行 带有命令的 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 文件,它将静默调用批处理文件。