Repository: go
Issue: x/sys/windows/svc: Failed to start windows service with Start Parameters
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.14.14 windows/amd64
</pre>

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Administrator\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\2\go-build198320826=/tmp/go-build -gno-record-gcc-switches

</pre></details>

### What did you do?

Tried creating windows service for windows console application that runs webservice. Followed example from https://github.com/golang/sys/tree/master/windows/svc/example 

Based on above example I'm able to install windows service using go. But when I try to start it with start parameter it is not working in expected way. I used following configuration for created windows service,


	serviceConfig := mgr.Config{
		StartType:      mgr.StartManual,
		DisplayName:    name,
		Description:    desc,
		BinaryPathName: ExecutablePath,
		ServiceStartName: UserName,
		Password:         Password,
	}

	s, err = m.CreateService(name, w.ExecutablePath, serviceConfig, "init")
	if err != nil {
		log.Errorf("Failed to create %s service due to %s", name, err)
		return err
	}
	defer s.Close()

I assume command line argument(start parameter) Added properly in service (init command appears with executable path so...), refer below image.

![image](https://user-images.githubusercontent.com/66402782/132353811-f5b8e397-d104-4de8-ab5c-25fb316b168e.png)

I programmed like whenever init is executed with that application, log will be written in log file. If I run that manually logs are properly updated. But with this windows service it is not working properly. Likewise I want to create webservice start/stop through windows service.

In above image "start parameter" field is also empty. Whether this is correct way of doing it ? If not please share examples.

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->



### What did you expect to see?

windows service with Start parameter would work properly.


### What did you see instead?

Windows service with start parameter is not working properly.