Powershell version info below:
Name Value
---- -----
PSVersion 5.0.10586.494
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.494
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I have the following powershell code:
Write-Host "Step 1..."
$find = "string-to-find"
Get-ChildItem -Path D:\path\path\ -Include *.dat1, *.dat2, *.dat3, *.dat4, -Recurse `
| Select-String -SimpleMatch $find `
| Select-Object -Unique Path
Write-Host "Step 2 ..."
Output:
Step 1...
Step 2...
Path
----
D:\path\path\test.dat1
Basically, the output from Get-ChildItem
is occuring AFTER the subsequent Write-Host
statement -- why????
Given that this code worked just fine in previous versions -- what is the correct output method one should use to have the output displayed in the order it is executed?
Thanks in advance.
Still trying to get this to work using the following:
Get-ChildItem -Path D:\path\path\ -Include *.dat1, *.dat2, *.dat3, *.dat4, -Recurse `
| Select-String -SimpleMatch $find `
| Select-Object -Unique Path `
| ForEach-Object { $_ } | Write-Host
But the output looks like:
@{Path=D:\path\path\something.dat1}
@{Path=D:\path\path\something.dat1}
All I want is the full path name listed (like it was working before v5).