You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Victorique/vtqe/uac.go

34 lines
548 B
Go

4 years ago
// +build windows
package main
import (
"os"
"b612.me/wincmd"
"github.com/spf13/cobra"
)
var uaccmd = &cobra.Command{
Use: "uac",
Short: "Windows 使用uac权限打开文件",
Long: "Windows 使用uac权限打开文件",
Run: func(this *cobra.Command, args []string) {
if len(args) == 0 {
return
}
cmdLine := ""
if len(args) > 1 {
for _, v := range args[1:] {
cmdLine += v + " "
}
}
pwd, _ := os.Getwd()
wincmd.StartProcess(args[0], cmdLine, pwd, true, 1)
},
}
func init() {
cmdMain.AddCommand(uaccmd)
}