.PS1 To .exe

From rbachwiki
Revision as of 19:06, 2 December 2025 by Bacchas (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Converting a PowerShell script (.ps1) to an executable (.exe) can be achieved using tools like PS2EXE or IExpress.

Install-Module -Name PS2EXE
  • Convert the script: Use the Invoke-PS2EXE command, specifying the source .ps1 file and the desired output .exe file path. For example:
Invoke-PS2EXE -File C:\Path\To\YourScript.ps1 -OutputFile C:\Path\To\YourExecutable.exe
  • You can also include parameters like -NoConsole to prevent a PowerShell console from appearing when the .exe is run, or -IconFile to specify a custom icon.