PowerShell: Multi-Line Command

For better readability it is convenient to split long commands over multiple lines.

In Windows PowerShell a multi-line command can be created from a long command by splitting it using the backquote character.

In this note i will show an example of how to split a long command over multiple lines in PowerShell.

Cool Tip: Get history of previously executed commands in PowerShell! Read more →

Multi-Line Command in PowerShell

A long command in PowerShell can be spitted over multiple lines by using a space followed by the backquote character, i.e.  `.

For the example, lets say we want to split the following command over multiple lines:

PS C:\> keytool -list -v -keystore %JAVA_HOME%\jre\lib\security\cacerts

In PowerShell this command can be splitted as follows:

PS C:\> keytool -list `
                -v `
                -keystore %JAVA_HOME%\jre\lib\security\cacerts