Can I use PowerShell notation for multiple lines?

So make the scripts more readable, I would like to split them into several lines. Is this possible in PowerShell notation?

For example, take this:

(GC myfile.txt).Replace('a',b').Replace('c','d').Replace('e','f') | SC newfile.txt 

And write it like this:

 (GC myfile.txt).Replace('a',b') .Replace('c','d') .Replace('e','f') | SC newfile.txt 

I tried using backticks (`) and they do not work. Are there any options? I assume PowerShell v3 +

+6
source share
1 answer

I found the same problem, the easiest way to solve it is to place a point before breaking a line

 (GC myfile.txt).Replace('a',b'). Replace('c','d') 
+10
source

Source: https://habr.com/ru/post/985353/


All Articles