(Original article: https://blog.kenaro.com/2011/06/21/ps2exe-tool-for-converting-powershell-scripts-to-standalone-exe-files/)
I have implemented some new switches for PS2EXE:
-x86
This compiles the EXE to be run as 32 bit application also on 64 bit OS.
-x64
This compiles the EXE to be run as 64 bit application. Therefore an 64 bit OS ist necessary.
-runtime20
This creates an “.exe.config” file with this content:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Please read this article on MSDN http://msdn.microsoft.com/en-us/library/w4atty68.aspx
this may fix some errors that users reported to me.
You can download the new version ouf PS2EXE here:
Hello,
Thank you so much for creating this script. I will use this religiously! I have one question though. I’ve created a script using .NET forms. I ran ps2exe against it and it worked but when my script launches, it always launches a console window with it. Is there a way to hide this console window and just display the form in the script I created?
Thanks, Adam 🙂
Did you try parameter
-noconsole
= Starts the EXE without console window
Regards
Ingo
This works but I’m trying not to put this into a batch file. The script I created is a very simple GUI we’re wanting to place on all users’ desktops. I would prefer no console window to pop up at all with no switch if that’s possible.
Thanx for the script, its simply awsome. I am having trouble where if you create PS script with param to take multiple parameters and converting it to exe, the converted exe didnt accepts the parameters correctly. Is there a way to fix it ?
Hi. I have the same situation. No parameters allowed, neither Param() or $args[]. Please help. Thanks in advance
the -noconsole parameter seems to be ignored. i’ve made my exe and very pleased to have that functionality. a black console window shows for a second on executing the program and it would now be nice to avoid that. i’m using PS2EXE v0.2.0.0. please give detailed info about -noconsole
Finally I could pass parameters using $args[] array. But $args[] is no global, at least when I convert PS1 to EXE. So I assign parameters from $args[] to variables in the main routine and then pass it to the functions. I could’nt pass $args as parameter to functions, maybe to my inexperience en PS
Hi Thanks for the valuable tool but on windows 11 I got the following error “You are using PowerShell 4.0 or above.”