使用Read-Host命令-让我要求用户提供他所需的路径数量的输入,因此他/她需要一个接一个地放入将提供ACL列表的路径。Clear-Host$num_path= Read-Host "`n `n Enter number of paths" $New_num_path= Read-Host "`n `n Re-Enter nu
但是,当脚本运行时,“”的提示符在read-host之前运行,或者完全跳过: [String]$OU, )$OU) { $OU = Read-Host "Enter Tenant Resource Pool Name (exactly as appears in vCenter inventory)" }Read-Host -Prompt "Press Enter to exit"
非常简单的代码,我正在尝试使用read-host搜索一些具有特定扩展名的文件。然后,我尝试将其传递给一个get-子项目行,以便搜索上述扩展,但它就是不起作用。$SelectedFiles = Read-Host "Which type of file(s) do you wish to delete?"$TargetedLocation = Read-Host "Which location are the files located?"
我正在尝试找到一种方法,让类似于Read-Host的东西来询问用户是否要输出到列出的文件中。这样,我希望他们按y或n,然后代码继续,而不是先按y/n,再按enter。我尝试过查看Readkey和SendKeys (为用户按回车键),但都不起作用,因为它们似乎只有在用户在Read-Host上按回车键后才能执行。$OutputYN = Read-Host "Do you want the output file generated to $startDirectory\FolderList.txt?(Y/N)&qu