I'm new, so apologies if I'm not asking correctly.
I'm selecting a part of a text file and generating a new one with just that part with this code:
Select-String -Path .\input_file.txt -Pattern '\b\d{1,2}\.\d{1,2}\b' -AllMatches | % { $_.Matches } | % { $_.Value } > .\output_file.txt
This works when I execute it on PowerShell but now I need to do the same with a bunch of files in a directory... Is there a way to do the same as a batch script?
I'm not able to figure it out :(
Many thanks in advance!
for /f %%a in ('powershell -Command "Get-Date -format yyyy_MM_dd__HH-mm-ss"') do set datetime=%%a
Do something linePowerShell -Command "YOUR POWERSHELL CODE HERE"
.. You will need to escape your>
to get it to work. First make it work going to the screen. Then add the>
part and escape it. Sometimes, the escaping is so cumbersome and just isn't worth it.