title: Store the value of selection in variable and pass it to another function in PowerShell?
body: <p>I have input from one function in below way</p>
  
  <pre><code>function Start-MenuList 
  {
      $counter = 0
  
      "Below are boxes`n"
  
       Get-Content -Path 'abc.txt' | 
       ForEach {
          $counter++
          "$counter : Press $counter to select $(($PSItem -split '=')[0]) : $(($PSItem -split '=')[1])"
       }
  
       Read-Host -Prompt "`nPlease enter a selection"
  }
  
  Clear-Host 
  Start-MenuList
  
      1. Press 1 to select abc : abcde1234
      2. Press 2 to select def : abcde5678
      3. Press 3 to select chi : abcde9090
      Please make a selection:
  </code></pre>
  
  <p>Here if I select 1 as input in selection then I want to store the value for e.g. if I select 1 then it should store "abc" and "abcdef1234" in some variables and pass it to another function and display what we have in those two variables</p>
  
  <pre><code>func1 env boxname
  </code></pre>
  
  <p>file abc.txt</p>
  
  <pre><code>abc=abcde0001
  def=abcedf002
  ghj=abcefgh003
  </code></pre>