How to learn to play the guitar from scratch
Before I get into any practical advice, I want to start by talking about expectations and a healthy mindset toward learning the guitar from scratch. Rome wasn't built in a day, and unrealistic expectations can ruin the potentially fun experience learning an instrument can be.
One thing that sets the guitar out as slightly harder than some instruments is the physical toll it takes on your hands - which of course can't be avoided. Fingering your first chords on the piano will never quite hurt as much as it does on the guitar. This is why realistic expectations are especially important. You need the positivity to just pick it up again and have another go. There are no cheats or shortcuts and anyone who says otherwise is trying to sell you something.
Additionally, if guitar is your first instrument then you'll be learning how to play in time as well. It's a handful. Don't be discouraged by this though - gradually working on these things can be enjoyable if you know how to push yourself. Enjoy the music and measure your progress in a way which isn't self defeating - such as comparing your playing to how it was yesterday, or last week.
I recommend you start small, tapping into parts of tunes you have on your mind. Simple parts, like something which uses a single chord or a single string. I'll give you an example - my first memory of exploring the guitar was simply the 2 chord intro to Jeff Buckley's version of "Hallelujah". It must be about a 5 second snippet of the original song but I had it in my head and I just played it over and over, trying to get the notes all right without having to take long pauses. I was completely absorbed in the music, with nothing else on my mind.
Another memory I have was simply playing the riff to AC/DC's "TNT" on the low E string of a discarded classical guitar lying around in the house. What I think I did right here more than anything was enjoying the music I chose to attempt and I really tried to imagine the song playing while I was giving it a go. These were all songs I really loved at the time and I would notice if something wasn't quite right. I could sit there for ages playing these parts over and over and it didn't feel like ages, i'd just be focused on trying to get it sounding like the song.
I'm sure everyone who wants to play the guitar has songs like this - music they love and could listen to themselves playing over and over. Remove any distractions and have a think - write some ideas down. I do believe this is the best place to start. Without going out of your way and "practicing", you'll be developing every musically relevant skill - so you can just forget everything else for the time being.
If you're not sure where to start, most popular songs have an abundance of guides on the internet, tabs and videos showing which notes and fingers to use. It's a great idea to try and use available resources like this, especially free ones like tab forums and YouTube. There is a knack to getting exactly what you need out of them without distractions though, but that's an article for another time.
You may make a mistake and pick a song which is too difficult, but you aren't running a race. Simply forget it and search for another.
The question is, which song are you starting with?