Hello, i asked this question because I’m blocked !
I’ll explain you the situation. in the folder name C:\test i have 2 directory.
in the first directory I have one .txt name sentence.txt with the sentence “disovery of new planets”
in the second directory I have an other .txt name sentence.txt with the sentence “it’s difficult to discover planet”
I’ll to put each sentence in my column named “Sentence” but i don’t know how i can do it I try like this but without success :
$path= Get-ChildItem "C:\test"
try {
for ($i=0 ; $i -lt $path.Count ; $i++){
$result = $path| Select-Object -Index $i
$source = "C:\test\sentence.txt"
$Data = Get-Content -Path $source
$sentence= $Data[0].Split("
r")`
<#
$Display2 = $chemins | ForEach-Object -Process {
Add-Member -InputObject $_ -MemberType NoteProperty -Name Commentaire -Value ($sentence) -PassThru
} | Format-Table -Property Sentencecolumn -AutoSize
#>
<# function array
{
$d = New-Object PSObject
$d | Add-Member -Name Creation -MemberType NoteProperty -Value $new_name
$d | Add-Member -Name ID -MemberType NoteProperty -Value $i
$d | Add-Member -Name Commentaire -MemberType NoteProperty -Value $sentence
return $d
}
$Myarray=@()
$Myarray+= ForEach-Object -Begin{Select-Object -Index $i} -Process{
array -Nom "$sentence[$i]"
}
#>
else{}
}
but Each time my column Sentencecolumn is filled by the contained of the last directory but i don’t know why !
Can you help me ? thanks !