How to output strings to the console in PowerShell

How to output strings to the console in PowerShell

To output a string to the console in PowerShell, type

write-host string

It is easier to understand if you type the string you want to output in the string and enclose it in double quotation marks. The output will still be output even if you do not enclose it.

write-output also outputs to the console. The aliases are echo,write.

Here is an example

PS C:\work_ps> write-host test
test
PS C:\work_ps>

コメント

タイトルとURLをコピーしました