Twitter

Categories

PowerShell

PowerShell

PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language. Initially, a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core. The former is built on .NET Framework while the latter on .NET Core.

If you need to automate anything, PowerShell is the way to do it in Windows. It’s not always easy, but it is worth it: automation first!

PowerShell, Regular Expression

Regex Replacement Problem PowerShell: $1?

Madre mia! I’ve been trying to edit an HTML file using PowerShell. I only wanted to eliminate all the spans and paragraphs using regular expressions (would make sense)… and how hard can that be?
Well, it turned out to be pretty hard if you’re used to the replacement syntax of regular .Net expressions! After searching for hours I’ve discovered that $1 can’t be used in the same way as in .Net. Just use ${1}. Ouch!