how to display a child variable with parameter

42 Views Asked by At

greet i wrote an simple PowerShell script to store simple massage in variable ,and display the massage with parameter , it work pretty well. but when i add multiple value in the variable multiple varible

i can't call the specific variable with parameter

code :

[Parameter()]
[string]
$ParameterName.$var = "".Get-Variable -name $ParameterName  -ValueOnly         

and call it like this : help.ps1 var

it should display $var's value

problem is can i display the variable with multiple value ? for example

multiple variable

how can i display the $var[0] with the same method ?

1

There are 1 best solutions below

3
123 123 On
    [CmdletBinding()]
param (
    
        [Parameter()]
    
        [string]
    
        $ParameterName).
    $display  =
    "help.ps -powershell
    
              #powershell 
              #spd 
              #wpe
              #pot 
              #web
    "
    
    
    Get-Variable -name $ParameterName  -ValueOnly  
                                             
    $parameterName = Get-Variable -name $ParameterName  -ValueOnly
    
    
    start $ParameterName