Sensor66 instead type: ".\adb".
".\adb" logcat | Select-String -Pattern 'screen.?on'
Yeah, those instructions are a bit confusing.
The correct command doesn't have the quotation marks
.\adb logcat | Select-String -Pattern 'screen.?on'
Keep in mind that logs are in UTC time.
cd to the platform-tools folder and .\adb isn't needed if the platform-tools folder is added to PATH
Extraneous info for permanently adding adb.exe to PATH on Windows
1) If any readers don't remember where adb is at, do the following. If you do know, go to step 2.
Download the 64-bit installer for this app called everything. It's a tool that instantly finds anything you're searching for on the computer -- no time taken to search.
https://www.voidtools.com/downloads/
While installing it, I change the option: run as a service to run as administrator. I also don't associate .efu files on the last page.
Open the everything app, search platform-tools
right click on the folder it found and copy full name to clipboard
https://imgur.com/OeNHHg9
2) Open notepad, put this:
$env:Path = "C:\platform-tools;$env:Path"
Mine is at C:\platform-tools. Change this line so it's where yours is at (you just copied it from step 1)
3) Run any of 1 of these inside of powershell to find out what to call this notepad file and where to put it.
$profile
$profile.AllUsersAllHosts
$profile.AllUsersCurrentHost
$profile.CurrentUserAllHosts
$profile.CurrentUserCurrentHost
For example, if you have this in powershell:
$profile.CurrentUserAllHosts
C:\Users\[redacted_user]\Documents\WindowsPowerShell\profile.ps1
Note: redacted_username above
Name the file profile.ps1 and save it anywhere. Then find the file in your folders and move it to C:\Users\[redacted_user]\Documents\WindowsPowerShell\
You'll likely have to create this folder.
There is another one of those options in system32
4) Run this in powershell so our script we just made can run everytime we open powershell
Set-ExecutionPolicy RemoteSigned
Read the warning then type y then press Enter for yes. This allows scripts we make to run and any downloaded scripts need to be signed by a trusted organization/person.
5) Congratulations, all done. Every time you open powershell, you can run adb commands and it'll work.