我有一个命令
Get-Aduser -Filter 'Surname -like "Doe"' -properties * | Format-List
,但我想将其与使用内联语法的 Read-Host cmdlet 一起使用。类似的东西
Get-Aduser -Filter 'Surname -like "{Read-Host -prompt "User surname?"}"' -properties * | Format-List
这样做的正确语法是什么?或者正确的方法是使用单线和管道?
就是这个了
Get-Aduser -Filter "Surname -like ""$(read-host -prompt "User surname?")""" -properties * | Format-List