I have two files "name.txt" and "path.txt, contents for each file are below:
name.txt:
John
Mike
Paul
path.txt:
C:\directory\john.config
C:\directory\mike.config
C:\directory\paul.config
I want to print n'th line from each file together
Code:
$name = Get-Content "C:\path\name.txt"
$path = Get-Content "C:\path\path.txt"
foreach($var1 in $name){
foreach($var2 in $name){
Write-Host "$name - $path
}
}
Desired output:
John - C:\directory\john.config
Mike - C:\directory\mike.config
Paul - C:\directory\paul.config
My Output:
John - C:\directory\john.config C:\directory\mike.config
C:\directory\paul.config
Mike - C:\directory\john.config C:\directory\mike.config
C:\directory\paul.config
Paul - C:\directory\john.config C:\directory\mike.config
C:\directory\paul.config
I want to get the desired output, can anyone please help me how I can get the desired output?