Skip to content

Instantly share code, notes, and snippets.

@discentem
Last active June 24, 2021 03:00
Show Gist options
  • Save discentem/583f141b95e2055f4e1d047dedb52357 to your computer and use it in GitHub Desktop.
Save discentem/583f141b95e2055f4e1d047dedb52357 to your computer and use it in GitHub Desktop.
// https://docs.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys
root := `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run`
app := "C:\\path\to\\binary.exe"
// escape the quotes around app in registry.SetString() below
err := registry.SetString(root, "whateverNameYouWant", fmt.Sprintf("\"%s\" --arg1 thing --arg2 --arg3", app))
if err != nil {
return err
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment