PowerShell Studio 2014: File Templates

PowerShell Studio always contained templates for various file types. In previous versions, users who wanted to change the template had to manually edit the existing template files. Unfortunately whenever the user updated the application the installer would uninstall the application before applying an update, thus losing any modification made to the template. As a result, we added a new Create Template feature to PowerShell Studio 2014 that not only makes it easier to create templates but also preserves them after application updates.

Creating a Template

To create a template you can create a new file or simply open an existing template or file. Then use the Create Template option in the Ribbon’s file menu:


Then you are asked to save the file template:


Template files are simple text files that are located in the following user folder:

C:\Users\<username>\AppData\Roaming\SAPIEN\PowerShell Studio 2014\FileTypes

The file must have the same extension as the file type you wish the template to be applied to.

For Example, a file named UserTemplate.ps1 will only apply to .ps1 script files.

GUI Templates

If you are using a GUI form (psf file), it will take you to the usual GUI template dialog instead:


GUI forms are handled differently and require additional information when creating a template.


Template Variables

PowerShell Studio supports the following template variables that automatically expand when a template is loaded:

Variable Description
%AppName% PowerShell Studio name
%AppVersion% PowerShell Studio version
%Username% The user name specified in the settings.
%Company% The user company name specified in the settings.
%Year% Current Year i.e. 2014
%Date% Current Date i.e. 5/12/2014
%Time% Current Time i.e. 2:17 PM
%FileName% Inserts the file’s name. This will be empty for new non-project files.
%ProjectName% Inserts the file’s project name.
%GUID% Inserts a unique GUID.


Multiple Templates

In addition to preserving your changes, PowerShell Studio 2014 allows you to define more then one template per file type, where as in the previous versions you could only modify the preset template. For instance, a user who works as a contractor may require unique templates for specific clients. Now the user can create dedicated templates for each of his clients and every time a new file is opened, the user will be presented with a list of available templates:


Note: The template list will only appear if there is more then one template defined for a specific file type.


PowerShell Studio 2014’s new Create Template option is another new feature that makes it easier for you to customize the IDE to fit your specific needs.