在我今天的电子邮件中,我收到了一封关于获取未使用的驱动器号的电子邮件。 This was their solution:为什么这个工作(或如何)?
Get-ChildItem function:[d-z]: -Name | Where-Object {-not (Test-Path -Path $_)}
PowerShell Magazine BrainTeaser had this for a solution, same thing.
ls function:[d-z]: -n|?{!(test-path $_)}|random
我不知道如何function:[d-z]:
作品。我知道使用'd'到'z'之间的每个字符,但我不知道语法为什么起作用。
测试Get-ChildItem function:[d-a]: -Name
给你一个错误说Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard pattern is not valid:[d-a]:
所以是一个动态的参数?怎么没有出现Get-Help gci -full
?
谢谢。我从来没有意识到'功能:'是PSDrive。现在我明白了,我感觉没关系使用它。 –