58 lines
3.9 KiB
Plaintext
58 lines
3.9 KiB
Plaintext
PS2EXE
|
|
|
|
Script to convert powershell scripts to standalone executables
|
|
|
|
Assuming "ps2exe.ps1" and a scoure script "source.ps1" are in the current directory,
|
|
.\ps2exe.ps1 .\source.ps1 .\target.exe
|
|
compiles "source.ps1" into the executable target.exe
|
|
(if ".\target.exe" is omitted, output is written to ".\source.exe").
|
|
|
|
or start Win-PS2EXE for a graphical front end!
|
|
|
|
|
|
Usage:
|
|
|
|
ps2exe.ps1 [-inputFile] '<file_name>' [[-outputFile] '<file_name>'] [-verbose]
|
|
[-debug] [-runtime20|-runtime40] [-lcid <id>] [-x86|-x64] [-STA|-MTA] [-noConsole]
|
|
[-credentialGUI] [-iconFile '<filename>'] [-title '<title>'] [-description '<description>']
|
|
[-company '<company>'] [-product '<product>'] [-copyright '<copyright>'] [-trademark '<trademark>']
|
|
[-version '<version>'] [-configFile] [-noOutput] [-noError] [-requireAdmin] [-supportOS]
|
|
[-virtualize] [-longPaths]
|
|
|
|
inputFile = Powershell script that you want to convert to executable
|
|
outputFile = destination executable file name, defaults to inputFile with extension '.exe'
|
|
runtime20 = this switch forces PS2EXE to create a config file for the generated executable that contains the
|
|
"supported .NET Framework versions" setting for .NET Framework 2.0/3.x for PowerShell 2.0
|
|
runtime40 = this switch forces PS2EXE to create a config file for the generated executable that contains the
|
|
"supported .NET Framework versions" setting for .NET Framework 4.x for PowerShell 3.0 or higher
|
|
lcid = location ID for the compiled executable. Current user culture if not specified
|
|
x86 or x64 = compile for 32-bit or 64-bit runtime only
|
|
STA or MTA = 'Single Thread Apartment' or 'Multi Thread Apartment' mode
|
|
noConsole = the resulting executable will be a Windows Forms app without a console window
|
|
credentialGUI = use GUI for prompting credentials in console mode
|
|
iconFile = icon file name for the compiled executable
|
|
title = title information (displayed in details tab of Windows Explorer's properties dialog)
|
|
description = description information (not displayed, but embedded in executable)
|
|
company = company information (not displayed, but embedded in executable)
|
|
product = product information (displayed in details tab of Windows Explorer's properties dialog)
|
|
copyright = copyright information (displayed in details tab of Windows Explorer's properties dialog)
|
|
trademark = trademark information (displayed in details tab of Windows Explorer's properties dialog)
|
|
version = version information (displayed in details tab of Windows Explorer's properties dialog)
|
|
configFile = write config file (<outputfile>.exe.config)
|
|
noOutput = the resulting executable will generate no standard output (includes verbose and information channel)
|
|
noError = the resulting executable will generate no error output (includes warning and debug channel)
|
|
requireAdmin = if UAC is enabled, compiled executable run only in elevated context (UAC dialog appears if required)
|
|
supportOS = use functions of newest Windows versions (execute [Environment]::OSVersion to see the difference)
|
|
virtualize = application virtualization is activated (forcing x86 runtime)
|
|
longPaths = enable long paths ( > 260 characters) if enabled on OS (works only with Windows 10)
|
|
|
|
|
|
A generated executables has the following reserved parameters:
|
|
|
|
-debug Forces the executable to be debugged. It calls "System.Diagnostics.Debugger.Break()".
|
|
-extract:<FILENAME> Extracts the powerShell script inside the executable and saves it as FILENAME.
|
|
The script will not be executed.
|
|
-wait At the end of the script execution it writes "Hit any key to exit..." and waits for a key to be pressed.
|
|
-end All following options will be passed to the script inside the executable.
|
|
All preceding options are used by the executable itself and will not be passed to the script.
|