Issue with Converting .ps1 Script to EXE

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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>"Illegal characters in path"
</code>
<code>"Illegal characters in path" </code>
"Illegal characters in path"
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>"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."
</code>
<code>"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." </code>
"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."
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>"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."
</code>
<code>"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." </code>
"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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>"Config file path: "
</code>
<code>"Config file path: " </code>
"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!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật