How to convert a custom file type from.ps1 to.exe?

tj_zero 45 Reputation points

I want to convert my own powershell script to an .exe executable so that it can be run directly;

Hope the engineer can provide any of the following help:

  1. ps1 conversion exe free open source tool software download connection; (Recommended)
  2. Use the existing system environment of Windows11 to execute the corresponding command conversion; (If the system does not need to rely on third-party open source tools can also be implemented)

Above, hope to get your help, thank you;

A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,320 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Konstantinos Passadis 12,171 Reputation points

    Hello @tj_zero !

    You can achieve this with the use of PS2EXE

    I think it really has some nice features that can help you a lot !

    I hope this helps!

    Kindly mark the Answer as Accepted and upvote or post your feedback to provide additional help!


    0 comments No comments

  2. MotoX80 27,541 Reputation points

    It looks like you have 2 problems. The first is some issue with Invoke-ps2exe. For that one, I would think that you need to provide the .exe file name and not just the folder name in the Target file field.

    User's image

    If Powershell is not able to successfully execute your .ps1 script, then it may be that the encoding of the .ps1 file is not able to store whatever that last character in the password is. When using notepad, do a SaveAs and make sure that the encoding is set to either UTF-8 or "UTF-8 with BOM".

    When testing, modify "bl.bat" to just do something simple like "timeout.exe /t 10" instead of any Bitlocker process.

    If Powershell is able to execute the .ps1 file, then the most obvious conclusion would be that PS2EXE is unable to handle that last character.

    In that case, try changing the password.

    User's image

    0 comments No comments