Skip to content

Instantly share code, notes, and snippets.

@bytemain
Last active January 2, 2021 11:40
Show Gist options
  • Save bytemain/6c89e4ad1ec0a891c7c95fe9fdaeaad1 to your computer and use it in GitHub Desktop.
Save bytemain/6c89e4ad1ec0a891c7c95fe9fdaeaad1 to your computer and use it in GitHub Desktop.
powershell scripts
Get-Process -Id (Get-NetTCPConnection -LocalPort 5000).OwningProcess
$array = Get-ChildItem | Select-Object Name
foreach ($element in $array) {
$filename = [System.IO.Path]::GetFileNameWithoutExtension($element.Name)
Write-Output $filename
New-Item -Path C:\Users\withw\AppData\Local\Temp\artin-1i4qojv5 -Name $filename -ItemType Directory
}
Get-ChildItem -Recurse | Measure-Object | Select-Object -ExpandProperty Count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment