
(Credit to PowerShell MVP Doug Finke for the neat idea.) The script has a string parameter, Word, and an integer parameter, Number.

Let’s start with a very simple script, New-WordTree.ps1, that repeats a specified word for an increasing number of specified times (default = 1). So, the first rule of writing scripts for exes is to use only parameters that take string values.
#Script studio executable .exe
exe filesĪn executable file can pass a string or an array of string values to the PowerShell script inside. And new code in the executable file that PowerShell Studio and PrimalScript builds parses the input string and associates the parameter values with the correct parameters, so you don’t have to. But, users can now enter parameter names and values, just as they do for a script. You are still limited to strings values (and types that can parse string values). In the past, all parameters had to be positional, users had to enter parameter values without names, and enter them in the specified order, or your script would have to parse the input string and associate the values with the correct parameters.īut, a new feature of PowerShell Studio (beginning in 4.2.96) and PrimalScript (beginning in 7.1.72), makes this much easier. exe is not simple, because executable files don’t have built-in features to support objects other than strings or to support PowerShell’s parameter name and parameter value syntax. However, passing parameters to a script inside a native. I typically build executable files for GUI apps don’t have parameters, but you can build executable files for any script, including scripts that take parameters. Windows PowerShell is an interpreted language, so you cannot compile it, but you can wrap scripts (.psm1) and simple modules (.psm1) files in an executable file PowerShell Studio and PrimalScript have great support for packing scripts in executable files.

#Script studio executable how to
Output from a Script in an Executable File explains how to manage string output from a script in an executable file.Displaying Help for a Script in an Executable File explains how to display help for a script in an executable file.Parsing Parameters for a Script in an Executable File explains how to parse parameters manually for special uses.Passing Parameters to a Script in an Executable File explains how to use the special parsing features of PowerShell Studio and PrimalScript to make passing parameters easy for PowerShell users and authors.This is the first blog in a multi-part series about designing a Windows PowerShell script that will be packaged in an executable file.
