The PlayStation 1 was released in 1994, and soon became a popular console for its small size, low cost of manufacturing and high level of graphics. In recent years, the PS1 has seen increasing popularity due to retro game availability on platforms such as eBay or ROM websites. However, many games are still unable to be played unless they’re converted into an executable file (.EXE) format that can run on modern operating systems. This article will provide you with seven different ways to convert your PS1 files so you never need another .EXE converter again!
The “ps2exe” is a command-line tool that converts PlayStation 1 games into executable files. The ps2exe can be used to convert the game from an ISO, BIN, or CUE file.
PowerShell scripts may be executed in a variety of ways, but they all have one drawback: they can’t be run like any other Windows application (EXE). Perhaps you’d want to make it simpler for your users to execute scripts by preventing them from altering the code. It’s time to figure out how to turn a PS1 into an EXE.
How to Execute a PowerShell Script
You will learn how to utilize EXE to PS1 generators in this guide, as well as compare them so you can choose the one that best meets your needs.
Requirements
Throughout this guide, many tools are presented along with step-by-step directions on how to convert EXE to PS1. To follow along, make sure you have all of the prerequisites listed below.
- Administrator rights on a Windows machine
- PowerShell is bundled with Windows 7, 8.1, and 10 when you install the operating system. Though PowerShell 3.0 can execute certain scripts, it’s far preferable to upgrade to PowerShell 5.1 or PowerShell 7.
- Script execution is permitted by your PowerShell execution policy.
How to Execute a PowerShell Script From the Command Line
PS2EXE
The first tool on our list is the PS2EXE software. PS2EXE is a free, open-source PowerShell module that “does not transform the PowerShell script to another language,” according to the creator Ingo Karstein. It wraps the script in a lightweight C# PowerShell host and compiles the dynamically produced C# source code to an EXE file in memory.”
Visit Ingo Karstein’s blog to learn more about the origins of PS2EXE. The module’s development came to a standstill in 2017, but Markus Scholtes took over and created a GUI version of PS2EXE.
PS2EXE Module Installation
PS2EXE began as a PowerShell script, but when Markus Scholtes took over development, he turned it into a module. You’ll need to install the module from the PowerShell Gallery since PS2EXE needs it to convert your script to an executable.
Understanding and Creating PowerShell Modules is a related topic.
To install the PS2EXE module, follow the steps below.
- As an administrator, open a PowerShell console.
How to Run PowerShell as an Administrator is a related topic.
2. Use the Install-Module command to get the module from the PowerShell Gallery and install it.
3. When the question regarding an untrusted repository appears, type Y and click Enter. Don’t be concerned. This message is completely harmless.
Untrustworthy data source You’re using an untrusted repository to install the modules. If you trust this repository, use the Set-PSRepository cmdlet to update its InstallationPolicy value. Are you sure you want to install the ‘PSGallery’ modules? [Y] [A] Yes Yes to Everything [N] [L] is not an option. No to everything [S] [?] Suspend (The default value is “N”): Y
Using the Command Line to Convert EXE to PS1
PS2EXE offers both a command-line and a graphical user interface for converting PowerShell scripts to EXEs. Let’s start with command-line use.
A single line containing the basic PS2EXE command (Invoke-PS2EXE), the script’s path to convert, and the path to the EXE you’d want to build is required to convert a single PowerShell script to EXE through the command line.
## Invoke-ps2exe.source.ps1.target.exe is the entire command name. ## ps2exe.source.ps1.target.exe is an alias.
You may now start target.exe, which will execute the source.ps1 script’s code. While you launch the target.exe file if you didn’t utilize the NoConsole argument when converting your script, a PowerShell console will show.
How to Hide the Console
When you run target.exe in the preceding example, a standard PowerShell console will display. You don’t want to see this most of the time. You may avoid this by including the NoConsole argument in the EXE, as shown below.
“D:TestGet-LatestAppLog.ps1” “D:TestGet-LatestAppLog.exe” Invoke-ps2exe “D:TestGet-LatestAppLog.ps1” “D:TestGet-LatestAppLog.exe” -noConsole
PS2EXE Command-Line Conversion from EXE to PS1
You may also build the EXE for just x86 or x64 runtime, among other options. A list of accessible parameters may be seen on the GitHub release page.
Using the PS2EXE-GUI Tool to convert EXE to PS1
If you prefer not to utilize the command line, the PS2EXE module also has a graphical user interface. The GUI version, which was developed later, has virtually all of the same features as the command-line version.
With the GUI version of PS2EXE, converting EXE to PS1 is as simple as clicking a few buttons. And, unlike the command line, you can use a lovely File Explorer explore dialog box to browse and choose the source file (PS1).
You’ll need.NET 4.x on your machine to execute the GUI version. If you only have.NET 3.5x installed, you may get the PS2EXE-GUI for.NET 3.5x separately.
Assuming you’ve previously installed the PS2EXE PowerShell module from the previous section, open File Explorer and browse to one of the PS2EXE module folders listed below, then open the folder that corresponds to the module version.
Windows 32bit: C:Program Files (x86)WindowsPowerShellModulesps2exe<version>
Windows 64bit: C:Program FilesWindowsPowerShellModulesps2exe<version>
A file named Win-PS2EXE.exe may be found within these files.
- Open the C:Program FilesWindowsPowerShellModulesps2exe<version>Win-PS2EXE.exe utility.
2. Locate the PS1 script you want to convert by clicking the ellipsis immediately to the right of the Source file box.
3. Fill in the Target file’s value, making sure to include the.exe file extension.
4. Below, you may make any changes you like to the conversion. Like the command-line version, this is merely a GUI representation of the parameters you may use for your script.
5. To begin the conversion process, click Compile.
PS2EXE GUI for converting EXE to PS1
PS2EXE will establish a PowerShell session and conduct the conversion when you click the Compile button. When you’re finished, hit Enter or close the console window.
EXE to PS1 Conversion Completed
NOTE: Your antivirus program may recognize certain executable files produced using PS2EXE as viruses. If this occurs, make careful to notify your antivirus provider about the false positives.
EXE to PS1
EXE to PS1 is another free desktop application developed by F2KO Software that enables you to convert a PS1 to an EXE file. The EXE to PS1, unlike PS2EXE, is a GUI tool complete with a simple script editor.
Just like PS2EXE, EXE to PS1 also has both the GUI and Command-Line version. However, instead of the PowerShell console, EXE to PS1 requires you to run the commands inside the Command Prompt.
Unfortunately, although F2KO’s website is still up, there seems to be no way to download EXE to PS1 from there. Luckily, a downloadable installer of this tool has been circulating on the internet.
Let’s go through how to run and use EXE to PS1 to create an EXE from a PowerShell script.
Converting EXE to PS1 Using GUI
After you install and launch EXE to PS1, you’ll notice that EXE to PS1 has a simple script editor. Inside this script editor, you can build and save scripts and click a button to convert them.
EXE to PS1 supports dot-sourcing; notice how another PS1 file was called with the command-line below.
## Invoke the AppLogsComplete method. ps1 catch.AppLogsComplete.ps1 ps1 ps1 ps1 ps1 ps1 ps1 ps1 ps1 ps1 ps1 ps
To convert a script to an EXE with EXE to PS1:
- Open the EXE to PS1 tool from your desktop.
2. Click on File —> Open, find the script you’d like to convert and open it.
Configure how you’d want the built EXE to execute after you’ve opened the script. A panel with three tabs will appear on the right side of the screen for you to explore. Each tab offers a separate setting option that you may choose.
Setting the EXE Output Options
3. Select the Embed tab, then Add to add dependant scripts.
4. To convert the script to an EXE, click the Convert button on the top toolbar when you’re happy with the conversion parameters.
Converting Script to EXE and Adding Dependent Scripts
Converting EXE to PS1 Using the Command Line
If you’d rather stick the command-line, EXE to PS1 CLI called ps1_to_exe.exe but to use it is a bit tricky.
With EXE to PS1 open:
- As an administrator, open a Command Prompt.
2. Change the working directory to EXE to PS1’s installation folder.
x86 cd ‘C:Program Files (x86)EXE to PS1’ x64 cd ‘C:Program FilesEXE to PS1’
3. Run the ps1 to exe command to convert the PS1 to an executable.
The command below adds a dependant script in the built EXE file and changes the target platform of the executable file to a 64-bit Windows OS.
ps1 to exe /ps1 “D:TestGet-LatestAppLog4.ps1” /exe “D:TestGet-LatestAppLogs.exe” /include “D:TestAppLogsComplete.ps1” /invisible /x64 ps1 to exe /ps1 “D:TestGet-LatestAppLogsComplete.ps1” /exe “D:T
The actual conversion procedure as well as the output information are shown below.
Converting Script to Executable Using EXE to PS1 Command-Line Version
IExpress 2.0 is a new version of IExpress.
If you’d prefer not download another program, you’re in luck since you can utilize the old IExpress application instead. IExpress is a built-in Windows program that is used to package files and create software installations.
It just so has it that IExpress can also convert EXE to PS1s while compiling dependency files altogether in a single executable file!
To convert a basic PowerShell script to EXE, follow these steps:
- IExpress must be run as an administrator. To open the Run dialog box, use the Windows*+R* key, type iexpress, and then hit the Ctrl+Shift+Enter key.
As an administrator, run IExpress
2. To setup your package, go to IExpress’ welcome page and pick Create new Self-Extraction Directive File, then Next. Consider the Self Extraction Directive (SED) file to be a configuration file that controls the parameters used when creating an installation package.
Make a new file for the Self Extraction Directive.
3. Click Next after selecting the Extract files and execute an installation command option. This option extracts files that will be included in the program installation if you’re making one. When you start the executable file, you may also write a custom command to execute the script.
When running the EXE, choose an action to take.
4. Next, give your package a name and click Next. All of the prompts the user will encounter throughout the installation will include the package title.
If you’re making a software installation, the package title is solely relevant. It makes no difference what the title is in this circumstance.
Setting The Package’s Title
6. Finally, choose No prompt. When you choose No prompt, the user is not presented with an extraneous dialog box when they start the EXE.
No Prompt
6. If the package is for a project that needs an End User License Agreement (EULA), you may choose to include a license that appears when the EXE is executed. However, for this example, choose Do not show licensing and click Next.
Including an End User License Agreement in the mix
7. Now go to Add and search for all of the scripts you want to include in this EXE. Include any dependant scripts and any files that the scripts reference, as well as the primary script you wish to call.
Choosing Which Files Should Be Included In The Package
8. In the Install Program to Launch window, use the File argument to provide the location of the powershell.exe engine. Also, make sure the ExecutionPolicy argument is set to Bypass so that any pre-configured execution policies don’t stop the script from running.
-ExecutionPolicy Bypass -File Get-LatestAppLog.ps1 powershell.exe
Creating Your Own Command
9. After that, you may specify how the EXE windows should act when they are run. Choose Hidden and click Next if the EXE is designed to run in the background. The most frequent window behavior is hidden.
Choosing the Window Behavior of an EXE During Execution
10. You don’t need to add a Finished message since you’re merely executing an EXE in the background. Next, choose No Message.
Creating a Message for After Installation
11. Now choose the location of the EXE you want to create. You may also activate a few additional settings here. After you’ve finished, click Next.
- Hide the file that extracts the user’s progress animation – Keep this option disabled if your EXE runs in the background.
- To support Long File Names during the extraction process while launching the EXE, store files with long file names within the package. If you’re installing the program on Windows 95 and will be utilizing an INF file, this option should be deactivated.
Setting Up The File Name And The Target Path
12. You may pick Always restart here if you want the EXE to restart when the script is finished. After you’ve made your choice, click Next.
Choosing Whether Or Not To Require A Restart
13. Click Next after selecting Save Self Extraction Directive (SED) file. You may alter any parameters you’ve supplied during this process later by saving a SED file. All of the values supplied so far are answered in the SED file.
Information about the Package Configuration is being saved.
It’s now just a matter of compiling the package. When you click Next, a process log will appear. Click Finish to finish building the package, and you’re done.
Run as Administrator Privileges are Required
If you have a script that needs to execute as an administrator, IExpress does not provide that option, but it is still doable.
Copy the code below and put it at the start of your script before launching IExpress. This code snippet determines whether or not the script is being executed as an administrator. If not, it will automatically quit and execute the script with administrator rights.
Remember to alter the WindowStyle **parameter on the Show Window screen depending on how you want the EXE’s window to appear or disappear when it runs.
param([switch]$Elevated) function Test-Admin { $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) } ## Test if the script is running as admin, if not, run it again as admin if ((Test-Admin) -eq $false){ if ($elevated) { } else { try{ Start-Process powershell.exe -WindowStyle Hidden -Verb RunAs -ArgumentList (‘-noprofile -file “{0}” -elevated’ -f ($MyInvocation.MyCommand.Definition)) ## Window Styles : Normal, Minimized, Maximized and Hidden ## ——> THE REST OF YOUR SCRIPT GOES HERE <—— ## } catch{ exit } } exit }
ISE Steroids are a kind of anabolic steroid that
If you love writing scripts in the PowerShell ISE, this tool suits your style. ISE Steroids are a kind of anabolic steroid that is an extension to the PowerShell ISE editor packed as a PowerShell module that adds many ISE features.
ISE Steroids are a kind of anabolic steroid that has many features, but the one you’re here for is its ability to convert a script to an EXE, so let’s dig in.
- Assuming you’ve already got ISE Steroids are a kind of anabolic steroid that installed, open the PowerShell ISE.
2. Run Start-Steroids from the integrated console to start the extension and load Steroids.
3. In the editor window, open or compose a new script. These files will be used in this lesson.
4. Click on the Tools —> Turn Code into EXE option just like in the screenshot below.
Compiling EXE to PS1
5. In the tiny window below, specify all of the parameters you’d want to apply to the final EXE. These are parameters, similar to PS2EXE’s, for configuring the attributes and behavior of your EXE file.
The Executable File’s Configuration
6. Once you’ve set all of the options, click on the Create Application button. ISE Steroids are a kind of anabolic steroid that will then ask you to select a target path. After that, you’re done converting your EXE to PS1.
We’ve chosen Visual Studio (VS) Code as our next editor. Many PowerShell developers have accepted VS Code, Microsoft’s suggested substitute for the PowerShell ISE.
A Tutorial on What You Need to Know About VS Code
Although there isn’t a natural mechanism to convert PowerShell scripts to EXEs in VS Code, you may use the PowerShell Pro Tools addon to do it. The PowerShell Pro Tools addon lets you package scripts, contains a GUI designer, and more, in addition to converting scripts to EXE.
For packaging scripts, PowerShell Pro Tools requires both the.NET 4.6.2 (or later) Developer Pack and.NET Core 1.0 or later.
For this tutorial, you’ll use Get-LatestAppLog3.ps1 and AppLogsComplete.ps1.
Assuming you’ve installed Visual Studio Code and the PowerShell Pro Tools extension:
- To convert to an EXE, open VS Code and a PowerShell script.
2. Click the Package Script as Exe button in the top-right corner of VS Code, as shown below.
Creating An EXE From A PowerShell Script
3. PowerShell Pro Tools creates a package.psd1 file in the current workspace’s root when you produce an EXE from a script for the first time.
Workspace Root and PowerShell Data File are shown (PSD1)
4. The contents of the package The Root key in the psd1 file is immediately provided with the script’s precise path to convert. As seen below, define the Output Path key to indicate the path to store the EXE.
Root and Output Path Configuration
5. You’ll see several log messages in the Output pane at the bottom of the screen when you produce an EXE from a script. If any mistakes occur during the compilation of the script, they will be shown here.
In the Output Pane, you can see the logs.
Other Scripts Compilation in the Same EXE
The PowerShell Pro Tools addon can now handle dependant scripts that are invoked from your main script. PowerShell Pro Tools needs you to dot-source any scripts you want included with the EXE in order to do so.
The Get-LatestAppLog3.ps1 script is the major one that has to be compiled. It executes the AppLogsComplete.ps1 script inside of it. You must dot source the script or bring it into the current script’s scope to ensure that PowerShell Pro Tools includes the dependant AppLogsComplete.ps1 file.
Understanding PowerShell Variable Scopes is a related article.
“$PSScriptRootAppLogsComplete.ps1” “$PSScriptRootAppLogsComplete.ps1” “$PSScriptRootAppLogsComplete
Inside The Main Script, Using Dot-Sourcing To Call Another PS1
After you’ve dot-sourced any required scripts, click Package Script as Exe to begin converting your scripts to an executable file.
PowerGUI
PowerGUI was one of the original PowerShell script editors. Although it seems to have been long forgotten about, you can still find the copies lingering on the web. Why speak of a long-forgotten PowerShell script editor? Because it has a built-in EXE to PS1 converter!
Although PowerGUI’s website is no longer active, copies may still be found on sites like Softpedia.
PS1 Script to EXE Compilation
When you run PowerGUI once it has been installed, you will see a Start Page. To begin assembling your scripts, use the toolbar to either Open an existing script or create a new one., as seen in the picture below.
Open an existing script or create a new one.
Click the Tools menu after you’re happy with your script. Then click Ctrl+F9 on your keyboard or pick Compile Script.
Begin compiling the script into an EXE executable.
Configure how you want the EXE to execute once it’s been converted. The Compile Script box, as seen below, has many choices for the EXE’s behavior that you may choose.
- To convert your PS1, click the Browse button and go to the PS1 you wish to convert.
2. Target Framework from Microsoft.NET Framework 3.5 to.NET Framework 4.0 is supported by PowerGUI.
3. Disable the Show PowerShell Console window when the script is running option if you simply want the EXE to run in the background.
4. If you have additional files to include, click the Dependencies button (bottom-left). Other PowerShell scripts that your script depends on, in most cases.
5. Once you’re happy with the configuration, click OK to start converting your EXE to PS1.
Compiled EXE Behavior Configuration
On a side note, you’ll see that PowerGUI has a drawback when it comes to managing how the EXE runs. PowerGUI does not provide many possibilities, such as parameter addition.
PowerGUI also doesn’t give you an option to embed information such as copyright, version, and description, unlike other EXE to PS1 generators. But if it doesn’t bother you that much, then PowerGUI is a good find you can keep.
Studio for PowerShell
To round off our list of EXE to PS1 converters, let’s end with one of the most feature-rich PowerShell IDEs, Sapien Technologies’ Studio for PowerShell. Built from the ground up as an exclusively PowerShell IDE, it would be a disservice to Studio for PowerShell to only demonstrate its ability to convert PS1s to EXEs. Still, we only have a limited amount of space!
Just like PowerShell Pro Tools in Visual Studio Code, Studio for PowerShell also has strict Requirements for packaging scripts; such as .NET Framework 4.8, .NET 5 for PowerShell 7 and Visual Studio 2015-2019 Runtime
Assuming you have Studio for PowerShell installed, open Studio for PowerShell and create or open an existing PowerShell script. This tutorial will use the Get-LatestAppLog3.ps1 script.
Changing the Settings
Before you convert a script in Studio for PowerShell, you should first learn the plethora of ways you can change the behavior of the resulting EXE.
Choose Settings from the Package button in the top-right corner of the window. This brings up the Script Packager box, where you may customize all of your parameters.
Creating An Executable File From A Script
Each setting in the Script Packager has a significant impact on how your EXE file’s output looks. These settings are shown with screenshots in the following sections.
Engine for Scripts
The Engine for Scripts section focuses on the target platform and the Engine for Scripts to compile your executable file.
Start with selecting your Target. You get to choose either a 32-bit or 64-bit version of windows, or you can choose both for flexibility. Studio for PowerShell will create an EXE for each platform you choose here.
Setting Up The PowerShell Scrip Engine And The Target Platform
Settings for Output
This section contains options for customizing the EXE file once it has been compiled.
- The name of the generated EXE is called the output file.
If you don’t specify a file extension (.exe), the field will be automatically set for you.
- Output folder – Where Studio for PowerShell will save the executable file.
- Resolve and include external scripts — If your main script has dependant scripts, make sure this option is selected. External scripts will be ignored when building your executable file if you don’t activate this.
Ensure that any dependant scripts are stored in the same folder as the main script.
- Signing — A location where you may look for a certificate to sign the EXE, as well as the certificate’s password (if it has one).
Managing The Settings for Output For The Executable File
Files with Icons
An icon helps you distinguish applications from one another, and the Files with Icons section gives you that option to add an icon for your executable file.
To add an icon file, click on the Add File button or simply drag and drop the icon file in the Files with Icons section.
Add Files with Icons
Restrictions
You may add or omit criteria in the Restrictions section to enable EXE execution.
If you choose an operating system in this area, the resultant EXE will run exclusively on that operating system. You may also provide conditions such as whether a given user must be logged in, if the machine must have a specific MAC address, and so on.
You have complete control over when the generated EXE runs, as seen below.
Execution Restrictions for Added Security
Information about the version
When Studio for PowerShell creates an EXE, that EXE has various file attributes. In the Information about the version section, you can define what those attributes look like.
Attributes such as File Version, Product Version, Copyright, and so on may be specified here. All of the possible qualities are listed below.
Setting File Information about the version
Build Alternatives
Lastly, you will find a Build Alternatives section. In this section, you can add custom pre-build or post-build commands to execute. This option will execute PowerShell commands before or after compiling the script to an executable file.
Let’s say you want to run some code right after Studio for PowerShell finishes creating the EXE. To do so, click on the New (Insert) button in the Post-build commands box. Both the pre-build and post-build commands accept PowerShell commands directly.
You may also pick another program or PowerShell script to launch by clicking the Add File (ellipsis) button.
Adding Custom Commands to Run Before or After a Build
After you’ve finished configuring everything, click OK to save the script as an executable. The location of the file will immediately open, allowing you to inspect the executable file.
External PowerShell Script Dependencies Must Be Considered
Sometimes a PowerShell script isn’t self-contained. Other scripts may be called by a script. Some of the technologies described here do not automatically discover and build these dependant scripts when converting to an EXE.
The path may vary when a script includes a reference to another script and that script is converted to an EXE. When this occurs, the PowerShell code within the EXE fails because it can’t locate the dependant script.
Perhaps you want to convert a script that calls other scripts in the same folder. Because the scripts are all in the same working directory, the PowerShell console can discover them when you execute it. This may happen when you convert a script to an EXE.
Add the following code snippet to the start of your PS1 script if you want to convert it to an EXE and have it call other scripts in the same directory.
As long as they’re both in the same directory, this code snippet resolves the path of an external script you’re executing from the main script.
$ScriptPath = Split-Path -Parent -Path if ($MyInvocation.MyCommand.CommandType -eq “ExternalScript”) $MyInvocation.MyCommand.Definition $MyInvocation.MyCommand.Definition $MyInvocation.MyCommand.Defin else $ScriptPath = Split-Path -Parent -Path ([Environment]::GetCommandLineArgs()[0]); $ScriptPath = Split-Path -Parent -Path; $ScriptPath = Split-Path -Parent -Path; $ScriptPath = Split-P $ScriptPath = “.” if (!$ScriptPath)
Comparison of Features
If you still haven’t made up your mind yet on how you’d like to create an EXE from a PowerShell script, take a look at the below table. This table provides a bird’s eye view of the features of each tool to help you decide which tool to be your choice of EXE to PS1 converter.
Comparison of Features
The “convert powershell script to exe using visual studio” is a guide that will help you convert your PS1 to EXE. The guide has 7 different ways in which this can be done.
Frequently Asked Questions
How do I make a PowerShell script executable?
A: You need to make a batch file with the same name as your script and run it from there.
How do I convert a PowerShell script to GUI?
A: The best way to start is by downloading a program like Notepad++. In there, you can go ahead and paste your code in the text editor window. Then click File>Save As>Powershell>.
How do I convert a PowerShell script to MSI?
A: You can use the following expression to convert a PowerShell script into an MSI file.
$myMSI = @
Related Tags
- ps1 to exe download
- ps1 to exe gui
- convert ps1 to exe online
- ps2exe-gui
- ps2exe module