Trying to read a file that having comma delimited rows. I want to read each row and split into array and make a global variables with the array values.
File content:
server1,component1,service1 server2,BatchProcessor2,service2 server3,BatchProcessor3,service3
I want to create a global variable as a directory path like below while reading each row.
$deployment.path = D:\server1\component1\service1
$deployment.path = D:\server2\component2\service2
$deployment.path = D:\server3\component3\service3
But I get null values.
Code:
$fileIn = 'D:\Test\build.properties.dev'
(Import-Csv -Path $filein -Delimiter ',' -Header 'ServerName','ComponentName','ServiceName' | ForEach-Object {
$deployment.path = D:\$_.ServerName\$_.ComponentName\$_.ServiceName
if (!(Test-Path $deployment.path)) {
New-Item -ItemType Directory -Force -Path $deployment.path
}
})
$Deployment
come from? you are assigning a value t. a prop of that $Var, but i don't see where it comes from ... – Lee_Daileyget null values
? – Lee_Dailey