I want to use netsh in my app ,the netsh depend some windows server,so i write the bat file ,before i run app i will start these system server
- bat file
regsvr32.exe /s C:\Windows\system32\Dhcp.dll
regsvr32.exe /s C:\Windows\system32\RpcSs.dll
regsvr32.exe /s C:\Windows\system32\nsi.dll
regsvr32.exe /s C:\Windows\system32\NetTcpPortSharing.dll
regsvr32.exe /s C:\Windows\system32\w32time.dll
regsvr32.exe /s C:\Windows\system32\iphlpsvc.dll
sc config Dhcp start= auto
net start Dhcp
sc config RpcSs start= auto
net start RpcSs
sc config nsi start= auto
net start nsi
sc config NetTcpPortSharing start= auto
net start NetTcpPortSharing
sc config w32time start= auto
net start w32time
sc config iphlpsvc start= auto
net start iphlpsvc
netsh interface portproxy reset
- golang code
func StartIpHelper() {
cmd := exec.Command("cmd", "/c", "start_depend.bat")
if err := cmd.Start(); err != nil {
logger.Errorln("start depend windows server err:", err)
return
}
}
My question
1. in my bat file ,some system server can not run. Maybe my exe do not have Administrator authority
I try this resp ,but not work as win7 and others windows sersiongith