Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. $myMatches = (Get-Content -Path .\Commands.ps1 -Raw) | Select-String "(?m)^function (\w*-\w*) \{[^}]+\}" -AllMatches
  2. foreach ($match in $myMatches.Matches) {
  3. $filename = "$($match.Groups[1].Value).ps1"
  4. $match.Groups[0].Value | Out-File -FilePath $filename
  5. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement