r/PowerShell • u/Hour-Bat7014 • Jan 29 '26
Question Doesn't work from the command line
$InputFile = "E:\turnOffCharge.txt"
$OutputFile = "E:\sendOFF.txt"
$TodayDate = Get-Date -Format "yyyy-M-dd"
We read the file, filter the lines containing today's date, and save it.Get-Content -Path $InputFile | Where-Object { $_ -like "*$TodayDate*" } | Set-Content -Path $OutputFile
0
Upvotes
View all comments
Show parent comment
1
u/sid351 Jan 29 '26
It's a legit question, not sure why you got downvoted.
Truth is, you without a (sanitised) sample of the input, and the error message(s), we're all a bit lost on how to help OP.