我有一个诸如此类的PowerShell脚本:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$age="8"
)
process
{
Write-Host "Your age is $age"
}
如何修改此脚本以便shell询问我的年龄并在其中放置8但允许用户在按Enter之前更改该值?
答案 0 :(得分:0)
不确定这是否是你所要求的,但我会这样做。
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$age="8"
)
process
{
$yourage = "8" + $age
Write-Host "Your age is $yourage"
}
如果年龄= 29岁 退货:您的年龄是829