1401
Finished Programs / Re: DONE: Append/Concatenate/Merge text files, but prepend filenames
« Last post by wraith808 on October 03, 2018, 03:29 PM »Code: PowerShell [Select]
Get-ChildItem ..\*.ps1 | ForEach-Object { Add-Content -Path 'output.txt' "----------`r`n$($_.FullName)`r`n----------`r`n"; Get-Content $_ | Out-File 'output.txt' -Append -Encoding utf8 }
Output:Code: Text [Select]
---------- Z:\test\Base64Encode.ps1 ---------- $Content = Get-Content -Path K:\favicon.ico -Encoding Byte $Base64 = [System.Convert]::ToBase64String($Content) $Base64 | Out-File K:\encoded.txt ---------- Z:\test\concat.ps1 ---------- Get-ChildItem ..\*.ps1 | ForEach-Object { Add-Content -Path 'output.txt' "`r`n----------`r`n$($_.FullName)`r`n----------"; Get-Content $_ | Out-File 'output.txt' -Append -Encoding utf8 } ---------- Z:\test\Detect-Computers.ps1 ---------- Ping 192.168.0.255 arp -a | select-string 'dynamic' | foreach {$_.line.trim().split(" ") | select -first 1 } | foreach {(Resolve-DnsName -Name $_ -ea 0).namehost} (Test-Connection SABnzbd -Quiet -Count 1)-4wd (October 03, 2018, 07:48 AM)
Google again? You have me wanting to use powershell for more than I use it for...

Recent Posts
