'Reading a process name how it is displayed in Windows Task Manager in Golang

I'm currently trying to read the name of a process in Go how it is represented in the windows task manager.

However, when I read it in Go it is displayed always as the executable. I'm trying to get it how it is named in the task manager.

Code:

package main

import (
    "fmt"

    "github.com/shirou/gopsutil/process"
)

func main() {
    p, _ := process.Processes()
    for _, pr := range p {
        fmt.Println(pr.Name())
    }
}

This outputs all process names but none match how it is shown here:

enter image description here

I am trying to read the Spotify process name that is displayed with the song title.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source