PowerShell to EXE compiler. Wraps PS1 scripts in native Windows executables using csc.exe (built into Windows).
- No external dependencies (uses .NET Framework's csc.exe)
- Custom icon support (.ico)
- Hidden window execution (no console flash)
- Small output (~4KB + encoded script size)
python ps2exe.py "whoami" -o test.exepython ps2exe.py -f payload.ps1 -o payload.exepython ps2exe.py -f script.ps1 -o app.exe --icon myicon.icopython ps2exe.py "Get-Process" -o procs.exe --waitpython ps2exe.py "whoami" --encode-only
# Output: base64 encoded command for -EncodedCommand| Flag | Description |
|---|---|
-f, --file |
Read PowerShell from .ps1 file |
-o, --output |
Output exe name (default: payload.exe) |
--icon |
Path to .ico file |
--wait |
Wait for command, show output (console app) |
--encode-only |
Just print base64 encoded command |
- Reads PowerShell command/script
- Encodes to Base64 (UTF-16LE - required by PowerShell)
- Generates C# wrapper that calls
powershell.exe -EncodedCommand - Compiles with
csc.exe(ships with Windows)
-NoP No profile (faster startup)
-NonI Non-interactive
-W Hidden Hidden window
-Exec Bypass Skip execution policy
-EncodedCommand Base64 encoded script
zip.ico included. Place any .ico in the same directory and reference with --icon.
- Python 3.x
- Windows with .NET Framework (csc.exe)
This project is free and open source. If you find it useful, consider supporting continued development:
We work tirelessly to build tools that help people get shit done - no paywalls, no subscriptions, just code that works. Your support helps keep it that way.
"I want to go back to the fundamentals, build things myself, break things in a lab, understand them from first principles... What you've shared is worth far more than the amount I'm sending."
— @ismailjaweedahmed, 10-year cybersecurity veteran
"For exposing pedo scum. Fan of your work, keep going."
— hxpnctrpstr
"For the children.. and also teach me c#nt"
— Qwenobi
George Wu - @rainfantry