Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PlagueHO/cc85b08d751b414f37e5ade7e73af09d to your computer and use it in GitHub Desktop.
Save PlagueHO/cc85b08d751b414f37e5ade7e73af09d to your computer and use it in GitHub Desktop.
Split a PowerShell Script containing multiple functions into a single function files
. .\utils.ps1
Get-Command *-CosmosDb* |
ForEach-Object {
$filename = Join-Path -Path (Get-Location) -ChildPath "$($_.name).ps1"
"function $($_.Name)`r`n{`r`n$($_.Definition)}" | Set-Content -Path $filename -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment