I’ve created a PowerShell script that updates Spicetify whenever I open Spotify via the shortcut in my “C:UsersUSERNAMEAppDataRoamingMicrosoftWindowsStart MenuPrograms” directory. The script consists of some code that closes Spotify, updates Spicetify and the Spicetify Marketplace, and finally it reopens Spotify. Here’s the code below that does this:
spicetify.ps1
# Close Spotify if it's running
Stop-Process -Name "Spotify" -Force -ErrorAction SilentlyContinue
# Update Spicetify
spicetify
spicetify backup
spicetify upgrade
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1" | Invoke-Expression
spicetify restore backup apply
# Reopen Spotify after updates
Start-Process "$env:APPDATASpotifySpotify.exe" -WindowStyle Normal
To make the Spotify shortcut in the “C:UsersUSERNAMEAppDataRoamingMicrosoftWindowsStart MenuPrograms” directory to run my script instead of the Spotify executable, I set the “target” of the shortcut to: “PowerShell -WindowStyle hidden -ExecutionPolicy Bypass -File “C:UsersUSERNAMEspicetify.ps1”” which then starts my script and immediately minimizes the window. Once the script finishes successfully, Spotify opens with Spicetfiy applied.
Here’s an image of the “Target” where I paste “PowerShell -WindowStyle hidden -ExecutionPolicy Bypass -File “C:UsersUSERNAMEspicetify.ps1”“:
Now the issue arises. If I have the Spotify shortcut pinned to my taskbar AND I have the Spotify application open, the taskbar will show 2 icons for “Spotify”, one of them is the shortcut that runs my script and the other is the actual Spotify application.
Here’s an image of the two Spotify taskbar icons:
The left icon is the actual Spotify application and the right one is my shortcut script.
I have noticed that some applications do this as well(e.g Parsec), but most seem to replace taskbar’s icon with the running application icon. I’m not entirely sure if the reason why they aren’t combined into one icon is because of the different targets or not, so I didn’t exactly know how to title this question on the post without all these details I’ve given. So, is there some way to make my shortcut script icon on the taskbar get replaced by the actual Spotify application icon so that there’s not 2 icons for the same application on the taskbar?
I attempted to go to the installation path of Spotify to try to run my script on the actual executable for Spotify, but you can’t seem to change the target or run a command in parallel to the application’s startup.
Here’s an image of the actual Spotify executable properties:
I’ve also checked that my taskbar settings are set to combine buttons automatically:
I also know (but haven’t attempted) that you can run commands automatically via the Windows Task Scheduler whenever an application like Spotify is started.
If there is no way to do what I’m looking to do, then I’ll go the Windows Task Scheduler route instead.