
- PowerShell 教程
- PowerShell - 主頁
- PowerShell - 概述
- PowerShell - 環境設定
- PowerShell - 命令
- PowerShell - 檔案和資料夾
- PowerShell - 日期和時間
- PowerShell - 檔案 I/O
- PowerShell - 高階命令
- PowerShell - 指令碼
- PowerShell - 特殊變數
- PowerShell - 運算子
- PowerShell - 迴圈
- PowerShell - 條件
- PowerShell - 陣列
- PowerShell - 雜湊表
- PowerShell - 正則表示式
- PowerShell - 反引號
- PowerShell - 括號
- PowerShell - 別名
- PowerShell 有用資源
- PowerShell - 快速指南
- PowerShell - 有用資源
- PowerShell - 討論
Powershell - Read-Host 命令
命令
Read-Host 命令用於從控制檯讀取。
在這些示例中,我們看到了 Read-Host 命令正在執行。
示例
在此示例中,我們將要求使用者傳遞一個輸入,並將該輸入讀入變數。
$choice = Read-Host "Please put your choice"
Powershell 將顯示一個彈出視窗讓使用者輸入值。輸入值後,它將儲存在 $choice 變數中。現在列印該變數。
$choice
輸出
您可以看到該變數的值。
1
powershell_advanced_cmdlets.htm
廣告