I am using the PS2EXE script from GitHub, and I am having an issue with my program after it’s converted.
I have already done this with a previous program, and it worked fine, but this second program is giving me issues.
For reference, here’s the first program’s code working fine:
https://pastebin.com/PyPbAHG7
This program will happily generate a configuration file if none exists in the first place, or load one if one is pre-existing. This works both when run as a PS1 file, and after conversion to an EXE file.
And now, my other program’s code:
https://pastebin.com/gz860yGK
THIS program has a few issues. It works PERFECTLY when running as Admin as a PS1 file, but after converting to EXE, it cannot seem to find any file paths, for the Config, nor for the 7zip in my C:/ drive as specified at the top of my code. I get these errors in dialog boxes when starting the program:
"Illegal characters in path"
"Cannot find drive. A drive with the name 'Add-Type-AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing.
# Path to 7z.exe
$7zip = 'C' does not exist."
"Cannot bind argument to parameter 'Path' because it is null."
"Cannot bind argument to parameter 'Path' because it is null."
"Cannot bind argument to parameter 'Path' because it is null."
(No, that’s not a mistake – I get the message 3 times)
In my code, there is a line to display the config file path, that I added as troubleshooting. When running as PS1, it displays the correct config path, as it does in fact generate one. In the EXE version, it does not generate a config, and the message for troubleshooting says this:
"Config file path: "
Obviously saying that it is returning an empty config, and it’s due to the fact that no config is generated.
And, when pressing the X button at the top of the window when it does show the GUI, it pops up a dialog box to say “Cancel” For some odd reason.
Now, say what you will about AI in coding, but to be completely honest, I do not know as much about coding as I’d like to. I have very basic knowledge in Python, Java, and C++, and zero knowledge about Powershell except for what I’ve learned here. I’ve used Copilot and ChatGPT to get me this far with both programs, but they are completely stuck on this issue.
Any help would be greatly appreciated!