Powershell: Match array strings (from 2 txt files) line for line

I am trying to figure out how to join strings from two arrays (line for line).
I need to run a third party app against a set of files. The output file generated by the 3rd party app (different file format) needs to be delivered to the same directory as the source file.
I have generated the required files:
$sourceFiles = c:\temp\sFiles.txt
$sourceDirs = c:\temp\sDirs.txt
# each line in both arrays need to be matched one for one
For instance:
sourceFiles.txt would contain:
sourceFolders.txt would contain:
As stated, I need to match the two line for line (up to 10000 lines)...SO

I need to be able to loop through the arrays run the app something like this:
& 'c:\program files\3rdPartyApp\App.exe' $sourceFile $sourceDir
& 'c:\program files\3rdPartyApp\App.exe' c:\one\please.log c:\one\two
.... and so on.

Not sure if this is possible?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this.
$sourceFiles  = Get-Content "c:\temp\sFiles.txt"
$sourceDirs = Get-Content "c:\temp\sDirs.txt"

for ($i = 0; $i -lt $sourceFiles .count; $i++)
	[Diagnostics.Process]::Start('c:\program files\3rdPartyApp\App.exe', $sourceFiles [$i] $sourceDirs[$i])

Open in new window

Sorry, extra space, here it is fixed
$sourceFiles  = Get-Content "c:\temp\sFiles.txt"
$sourceDirs = Get-Content "c:\temp\sDirs.txt"

for ($i = 0; $i -lt $sourceFiles.count; $i++)
	[Diagnostics.Process]::Start('c:\program files\3rdPartyApp\App.exe', $sourceFiles [$i] $sourceDirs[$i])

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
daveTechSearchAuthor Commented:
should that increment to the next line?... I am seeing it only increment to the next character on the first line
'c', ':', and '\'
daveTechSearchAuthor Commented:
Got it to work, with a little bit of rework... Thanks for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.