Caution
Do not store passwords in source code!
See the localized readme for more details.
ps12exe is a PowerShell module that allows you to create an executable file from a .ps1 script.
Install-Module ps12exe #Install ps12exe module
Set-ps12exeContextMenu #Set right-click menu(you can also clone this repository and run ./ps12exe.ps1 directly)
Hard to upgrade from PS2EXE to ps12exe? No problem!
PS2EXE2ps12exe hooks PS2EXE calls into ps12exe. Uninstall PS2EXE, install this module, then use PS2EXE as usual.
Uninstall-Module PS2EXE
Install-Module PS2EXE2ps12exeOnce you have set Set-ps12exeContextMenu, you can quickly compile any ps1 file into an exe or open ps12exeGUI on this file by right-clicking on it.

ps12exeGUIps12exe .\source.ps1 .\target.execompiles source.ps1 into the executable target.exe (if .\target.exe is omitted, output is written to .\source.exe).
'"Hello World!"' | ps12execompiles "Hello World!" into the executable .\a.exe.
ps12exe https://raw.githubusercontent.com/steve02081504/ps12exe/master/src/GUI/Main.ps1compiles Main.ps1 from the internet into the executable .\Main.exe.
exe21sp -inputFile .\target.exe -outputFile .\target.ps1exe21sp extracts the original PowerShell script from a ps12exe-generated executable (local path or URL) and writes it to a .ps1 file or standard output. It uses the same $LastExitCode convention as ps12exe: 0 = success, 1 = input/parse error (e.g. not a ps12exe exe), 2 = invocation error (e.g. no input when redirected), 3 = resource/internal error (e.g. file not found).
- ps12exe: When stdout (or stdin/stderr) is redirected, ps12exe writes only the path of the generated exe to stdout so you can capture it (e.g.
$exe = ps12exe .\a.ps1). - exe21sp: Accepts exe paths or URLs from pipeline input (e.g.
Get-ChildItem *.exe | exe21spor".\app.exe" | exe21sp). - exe21sp: If
-outputFileis not specified and stdout is not redirected, the decompiled script is saved to a.ps1file with the same base name as the exe in the same directory. - exe21sp: If
-outputFileis not specified and stdout is redirected, the decompiled script is written to stdout.
Start-ps12exeWebServerStarts a web server that can be used to compile PowerShell scripts online.
| Comparison Content | ps12exe | MScholtes/PS2EXE@678a892 |
|---|---|---|
| Pure script repository 📦 | ✔️ All text files except images & dependencies | ❌ Contains exe files with open source license |
| Command to generate hello world 🌍 | 😎'"Hello World!"' | ps12exe |
🤔echo "Hello World!" *> a.ps1; PS2EXE a.ps1; rm a.ps1 |
| Size of the generated hello world executable file 💾 | 🥰1024 bytes | 😨25088 bytes |
| GUI multilingual support 🌐 | ✔️ | ❌ |
| Syntax check during compilation ✔️ | ✔️ | ❌ |
| Preprocessing feature 🔄 | ✔️ | ❌ |
-extract and other special parameter parsing 🧹 |
🗑️ Removed | 🥲 Requires source code modification |
| PR welcome level 🤝 | 🥰 Welcome! | 🤷 14 PRs, 13 of which were closed |
Compared to MScholtes/PS2EXE@678a892, this project brings the following improvements:
| Improvement Content | Description |
|---|---|
| ✔️ Syntax check during compilation | Syntax check during compilation to improve code quality |
| 🔄 Powerful preprocessing feature | Preprocess the script before compilation, no need to copy and paste all content into the script |
🛠️ -CompilerOptions parameter |
New parameter, allowing you to further customize the generated executable file |
📦️ -Minifyer parameter |
Preprocess the script before compilation to generate a smaller executable file |
| 🌐 Support for compiling scripts and included files from URL | Support for downloading icons from URL |
🖥️ Optimization of -noConsole parameter |
Optimized option handling and window title display, you can now set the title of the custom pop-up window |
| 🧹 Removed exe files | Removed exe files from the code repository |
| 🌍 Multilingual support, pure script GUI | Better multilingual support, pure script GUI, support for dark mode |
| 📖 Separated cs files from ps1 files | Easier to read and maintain |
| 🚀 More improvements | And more... |
See the localized readme for more details.






