Is there a way to combine two string and make it as a current variable and get the data from it? I'm not sure if there's another way to do this. If there's any, please let me know.
Here's my code.
$App1 = "Google Chrome"
$App2 = "Mozilla"
$AppExt1 = ".exe"
$AppExt2 = ".msi"
$Apps = @('1','2')
ForEach ($Applications in $Apps) {
$AppToBeInstalled = '$App' + $_
$AppExt = '$AppExt' + $_
Write-Host "Application $AppToBeInstalled to be installed with extension $AppExt"
}
What I want.
Application Google Chrome to be installed with extension .exe
Application Mozilla to be installed with extension .msi
But I'm only getting empty result.
Application to be installed with extension
Application to be installed with extension