構文
Read-Host "Input"
Read-Host
に続けて、表示したいプロンプトを書くだけでOKです。
実行結果
PS C:\Users\Naoto\Documents\00.lab> Read-Host "Input" Input: test test
Read-Host "Input"
Read-Host
に続けて、表示したいプロンプトを書くだけでOKです。
PS C:\Users\Naoto\Documents\00.lab> Read-Host "Input" Input: test test
タイムスタンプをファイル名にしたいときなど、現在時刻を取得したいケースは多々あります。
Get-Date -Format "yyyyMMdd-HHmm"
PS C:\Users\Naoto\Documents\00.lab> Get-Date -Format "yyyyMMdd-HHmm" 20180204-1032
Write-Host "This is a test message."
Write-Host
は、コンソールメッセージを表示させるコマンドです。Linux でいう echo
コマンドに該当します。
PS C:\Users\Naoto\Documents\00.lab> Write-Host "This is a test message." This is a test message.