O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.1. Creating Scripts

The typical PowerShell script is a text file that we can create using various tools. By default, those files carry the .ps1 file extension. You can create them using Notepad, but it is best if you use a more powerful tool, one of the programmer text editors that offer features like syntax highlighting and even IntelliSense-like word completions. My favorite editor, which helped me with the examples for this book, is Notepad++, a free notepad.exe replacement that knows about many programming languages and offers syntax highlighting, word completions, and much more. You can even create scripts from the PowerShell console using here strings and the Set-Content cmdlet. Here is how to create our very first script:

PS> $code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required