TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Play spotify song with cmd in a particular minute. (Code and Help to Fix)

    Windows
    5
    11
    5.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Santiago
      last edited by

      Hi everybody.
      Searching the internet, I have achieved that through cmd I can run spotify and then play a specific song in a specific minute.

      The VB Script code is:

      Set WshShell = WScript.CreateObject("WScript.Shell")
      Comandline = "C:...\Spotify.exe"
      WScript.sleep 50
      CreateObject("WScript.Shell").Run("spotify:track:09mEdoA6zrmBPgTEN5qXmN#0:52")
      WScript.sleep 50

      This (#0:52) is what specified when in the song to start playing it. But now that the spotify interface has been updated it doesn't work anymore.
      Still open spotify and plays the selected song, but not in the minute that I specify.

      Does anyone know how I can fix it?

      (PS: I hope the code helps someone to be able to play songs from spotify)

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @Santiago
        last edited by

        @Santiago, I researched and found the same thing - they apparently stopped supporting that #0:52 parameter to jump to a specific part of the song. That's a bummer.

        In my testing I found another way to play a specific song. You can just run start spotify:track:1aICPClDGoZGvxAv8g5lmS but if Spotify is already open, it doesn't work, so I made this .bat file that closes Spotify then re-opens it by playing a specific song.

        taskkill /im spotify.exe
        start spotify:track:1aICPClDGoZGvxAv8g5lmS
        

        Russell VanderMey

        S José ParraJ John PaulJ 3 Replies Last reply Reply Quote 1
        • S
          Santiago
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • S
            Santiago @Russ
            last edited by

            @Russ Thanks for your reply!! Yes, its really a bummer. I dont know why they change that. Im going to test your .bat, thanks you again.

            1 Reply Last reply Reply Quote 0
            • José ParraJ
              José Parra @Russ
              last edited by

              @russ Excuse me, is it possible to make it play a playlist automatically?

              Edit your bat like this:
              "taskkill /im spotify.exe
              start spotify:playlist:39aWYh4Pq3xjPwOUChkO4a?si=f262d16984cd44b8"
              (replace music by playlist)

              1 Reply Last reply Reply Quote 0
              • U
                UchechiThomas
                last edited by

                I can't automate music playback either. Have you found the problem yet?

                RussR 1 Reply Last reply Reply Quote 0
                • RussR
                  Russ @UchechiThomas
                  last edited by Russ

                  @UchechiThomas, I found this post where people have solved it:

                  https://community.spotify.com/t5/Desktop-Windows/Is-there-a-command-to-play-a-playlist-using-command-line/td-p/952251

                  I found that this command switches to the playlist by ID:

                  start spotify:user:anything:playlist:22nGVo4QFZcfTAXcsl67kD
                  

                  The trick is to get it to start playing. This batch file worked for me:

                  taskkill /im spotify.exe
                  start spotify:user:anything:playlist:22nGVo4QFZcfTAXcsl67kD
                  ping localhost
                  nircmd sendkeypress spc
                  

                  The ping localhost command just makes it wait long enough to start Spotify. The nircmd command presses the space bar to start playing the playlist.

                  Russell VanderMey

                  1 Reply Last reply Reply Quote 1
                  • U
                    UchechiThomas
                    last edited by UchechiThomas

                    Thanks for the advice. I'll try to check it out today with the spotify promotion.

                    1 Reply Last reply Reply Quote 0
                    • John PaulJ
                      John Paul @Russ
                      last edited by

                      @Russ Thank you Russ. I am currently looking to create a hotkey to open a specific track in Spotify and this is exactly what I needed.

                      1 Reply Last reply Reply Quote 0
                      • John PaulJ
                        John Paul
                        last edited by

                        I am currently trying to play a podcast episode in this manner. I am able to pull up the episode in question with this code, however, it does not play automatically which I would definitely like it to do:

                        start spotify:episode:0yAefXW3oX7WbliU0DU8QB
                        
                        RussR 1 Reply Last reply Reply Quote 0
                        • RussR
                          Russ @John Paul
                          last edited by Russ

                          @John-Paul, please try this in a .bat script:

                          taskkill /im spotify.exe
                          start spotify:episode:0yAefXW3oX7WbliU0DU8QB
                          ping localhost
                          nircmd sendkeypress spc
                          

                          Russell VanderMey

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post