PowerShell 复制 Read-Host [[-Prompt] <Object>] [-AsSecureString] [<CommonParameters>]说明Read-Host cmdlet 从控制台 (stdin) 读取一行输入。 可使用它来提示用户输入数据。 因为可以将输入保存为安全字符串,所以可以使用此 cmdlet 来提示用户输入安全数据(例如密码)。
运行脚本时,可以使用 Read-Host cmdlet 获取用户的输入。 用户输入请求可以是启动脚本的提示,也可以是基于脚本中已发生的处理结果。 例如,在对 Active Directory 域服务 (AD DS) 用户对象执行查询并显示检索到的对象数后,脚本可能会提示决定是继续还是停止。 或者,脚本可以请求要搜索的...
获取当前数据使用read host命令,注意数据为字符串,需定义为强类型。使用read host命令输入数据,不依赖其他驱动,直接利用界面完成输入。
Invoke-Command -ComputerName read from file invoke-command 'Write-Host' is not recognized as the name of a cmdlet, Invoke-Command + cmd invoke-command access denied Invoke-command as remote local user Invoke-Command Execution Policy Invoke-Command for Get-NetIPConfiguration or Get-DnsClientServer...
例如,可通过使用 Read-Host cmdlet 提示用户提供安全字符串来手动提示输入密码。PowerShell 复制 Uninstall-ADDSDomainController -LocalAdministratorPassword (Read-Host -Prompt "Password:" -AsSecureString) 警告 由于前两个选项不确认密码,因此请务必谨慎小心:密码不可见。
如果您使用该find命令递归搜索某些文件,然后将结果通过管道传递给该grep命令,那么您实际上将解析文件路径/...
In a PowerShell script in Visual Studio Code, set a break point on a line that calls Read-Host. Launch a debug session, and run to the break point. Step over the line. EXPECTED RESULT: Focus automatically shifts to the console so the user can provide the input. ...
Read-Host Register-EngineEvent No event sources available on Linux/macOS Register-ObjectEvent Remove-Alias Remove-Event No event sources available on Linux/macOS Remove-PSBreakpoint Remove-TypeData Remove-Variable Select-Object Select-String Select-Xml Send-MailMessage Set-Alias Set-...
official文档或Read-Host -?会告诉我们,不可能以这种方式使用Read-Host。没有可能的参数告诉它在某种...
第二个命令使用 Read-Host cmdlet 从用户输入创建安全字符串。 Prompt 参数请求用户输入,AsSecureString 参数会屏蔽输入并将其转换为安全字符串。第三个命令使用 New-Object cmdlet 从存储在$User变量中的$PWord值创建 PSCredential 对象。示例5PowerShell 复制 ...