Quantcast
Channel: Windows PowerShell - SAPIEN Blog
Viewing all articles
Browse latest Browse all 308

Don’t always start from scratch

$
0
0

We use scripting to automate tasks that would otherwise be very repetitive. However, when it comes to creating a script most users start with a blank slate, an empty file. Then they hunt for copy and paste sources to start and the script fills with bits and pieces from other places. Next time a new script needs to be created, the same process starts all over again.

We have added a tiny little improvement to PrimalScript 2014 that might just make it easier for you to get started on a new script. You can save any file you have as a template with the content you want and need and the encoding your environment requires.

Let’s demonstrate.

image

We create a new PowerShell file from our default templates.

image

Maybe you don’t like our header, maybe you need some functions in there that you always use. Just modify as desired.

image

Now select “Save as template” from the backstage menu and give a fancy name. Make sure you use the correct extension, because that will determine the syntax coloring when you create a new file with that template.

image

In our example here we will name the file “My own PowerShell Template.ps1”

You can then close the file, or use it as a base for further templates you want to create. That’s up to you.

image

We used a list style control rather than big icons so you have more room for many templates and it also allows you to use longer, more descriptive names.

Questions? Comments? Suggestions? Head on over to our support forum and and let’s hear it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,


Viewing all articles
Browse latest Browse all 308

Trending Articles