shell 如何显示带参数子变量

lsmepo6l  于 12个月前  发布在  Shell
关注(0)|答案(1)|浏览(78)

问候我写了一个简单的PowerShell脚本来存储简单的消息在变量中,并显示消息与参数,它工作得很好。但是当我在变量x1c 0d1x中添加多个值时,
我不能用参数调用特定的变量
验证码:

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

然后这样命名:

它应该显示$var的值
问题是我可以用多个值显示变量吗?例如

如何用同样的方法显示$var[0]?

qzlgjiam

qzlgjiam1#

[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

相关问题