hi there!
$process_name is any match of the name of running process I want. Sometimes I want vlc, sometimes I want explorer, sometimes I want Notion, sometimes I want TogglTrack, sometimes I may want totalcmd, etc. etc.
Also, a substring is enough. The process names can be obtained by running Get-Process cmdlet.
Does it make sense? At the moment, I have also functions that are calling the main goto function so that it simplifies the process even more - for the four most often called programs. What they do in addition is they check if a program is running and open the window and if it is not running they start it.
function goms {
try {goto "vlc"}
catch {start vlc}
}
function govpn {
goto "pritunl"
}
function gotg {
try {goto "toggl"}
catch {start "C:\Users\Admin\AppData\Local\TogglTrack\TogglTrack.exe"}
}
function gono {
try {goto "notion"}
catch {start "C:\Users\Admin\AppData\Local\Programs\Notion\Notion.exe"}
}
→ then I just call gono or govpn or gotg or goms
Of course, the limitation of this is that I am calling only programs that I use with single running instance. For VSCode, where I often have 3 instances running, it is not usable (I am just uring Win+Number shortcut, but you have only 9 of those, right...)
Feel free to ask if something's not clear. Cheers,
Pavol