我有两个 PowerShell 脚本,它们有开关参数:
Compile-tool1. ps1:
[CmdletBinding()]
param(
[switch]$VHDL2008
)
Write-Host "VHDL-2008 is enabled: $VHDL2008"
Ps1:
[CmdletBinding()]
param(
[switch]$VHDL2008
)
if (-not $VHDL2008)
{ compile-tool1.ps1 }
else
{ compile-tool1.ps1 -VHDL2008 }
如何在不编写大的 if..then..else或 case语句的情况下将 switch 参数传递给另一个 PowerShell 脚本?
我不想将 compile-tool1.ps1的参数 $VHDL2008转换为 bool类型,因为这两个脚本都是前端脚本(用户使用)。后者是用于多个 compile-tool*.ps1脚本的高级包装器。