How to enter a multi-line command

2019-01-03 05:11发布

Is it possible to split a PowerShell command line over multiple lines?

In Visual Basic I can use the underscore (_) to continue the command in the next line.

8条回答
叼着烟拽天下
2楼-- · 2019-01-03 05:32

If you are trying to separate strings into multiple lines, you can use the "+". For example:

$header =    "Make," +

             "ComputerName," +

             "Model," +

             "Windows Version"

Will look just like:

$header = "Make,ComputerName,Model,Windows Version"
查看更多
姐就是有狂的资本
3楼-- · 2019-01-03 05:34

In PowerShell and PowerShell ISE, it is also possible to use Shift + Enter at the end of each line for multiline editing (instead of standard backtick `).

查看更多
登录 后发表回答