PS2EXE | PowerShell to EXE converter | Command Line Interface library
kandi X-RAY | PS2EXE Summary
kandi X-RAY | PS2EXE Summary
PowerShell to EXE converter
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Implements the prefixed behavior .
- Search for a single selector .
- example animation
- creates a promise which is resolved when a promise is resolved
- Callback for the AJAX request .
- Creates a new matcher matcher .
- workaround for AJAX requests
- Creates a new matcher instance
- Run DOM manipulation .
- Build a document fragment
PS2EXE Key Features
PS2EXE Examples and Code Snippets
Community Discussions
Trending Discussions on PS2EXE
QUESTION
$password = ConvertTo-SecureString “Password+++” -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ("Admin", $password)
$FileLocale = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
Write-Output $FileLocale
$AntFile = "$FileLocale\StartApps.ps1"
Write-Output $AntFile
Start-Process PowerShell.exe -ArgumentList "-command &$AntFile -UserCredential $Cred"
...ANSWER
Answered 2022-Feb-15 at 16:13While an executable compiled with ps2exe uses a .ps1
file as input, at runtime no actual .ps1
file is involved, which is why PowerShell's command-reflection variables cannot tell you anything about a running script file.
When running an actual .ps1
file, you'd use the following about_Automatic_Variables:
$PSCommandPath
contains the the executing script file's full file path.$PSScriptRoot
contains the script file's full directory path (i.e. the full path of the directory in which the script file is located).
In a ps2exe-compiled executable (.exe
), where these variables have no values, you can use the following instead:
[Environment]::GetCommandLineArgs()[0]
contains the executable file's full file path.Split-Path -LiteralPath ([Environment]::GetCommandLineArgs()[0])
contains the executable file's full directory path.
Applied to your code - assuming that a separate StartApp.ps1
file is present alongside your .exe
file:[1]
QUESTION
I have created a PowerShell script and then compiled it with PS2EXE. The program loads *.JSON-files and allows the user to edit it. The program starts with a file browser window to select the right *.JSON to load.
Now I want to try to run the program by double-click a *.JSON and skip the file browser window.
So I right klick the file > select open with > and choose mypowershellapp.exe and inspected the $PWD
var. But it was always the system32 directory.
So: How to get the file path the program was started from?
...ANSWER
Answered 2021-Nov-25 at 17:38Indeed: when you use File Explorer's Open with...
shortcut menu and select an application to pass the document at hand to, that application invariably launches with C:\Windows\SYSTEM32
as its working directory.
However, the document at hand is passed as an argument by its full path, so you can infer the directory it is located in.
That is, in your (compiled) *.ps1
script, do something like the following:
QUESTION
I have recently started learning to use xml with Powershell to create GUIs. My goal is to create an about box. I use VSCode and Notepad++ (No fancy Visual Studio for me, can't get approved for a license). What I have not yet been able to figure out is how to get the version number of my powershell tool into the xml so it can be displayed. Here are a few code snips
...ANSWER
Answered 2021-Sep-01 at 15:32Use an easily identifiable template string in the base XML and just replace that with the version in the file as a build step. In your XML, change the Text attribute of the XML element to use a replaceable value, such as {{VERSION_NUMBER}}
:
QUESTION
I am trying to suppress the output of a command while setting a variable. I need to do this because I have compiled the PowerShell Script using PS2EXE-GUI. This program shows all command output on a seperate window, which is very annoying and is not necessary. I am trying to use Get-ChildItem "$MYSQLFOLDERLOCATION" | Out-String | Write-Host
, but this only works when there is nothing in the directory, anything else, and it shows the directory contents on the screen. I have also been trying to use Get-ChildItem "$MYSQLFOLDERLOCATION" | $ISMYSQLFOLDERPRESENT = $? | Out-Null
, but this is syntactically incorrect. Is there something similar to this that I can use? I basically want to do an ls-equivalent command in PowerShell, then store whether it succeeded or not, while not showing anything on screen (I can't use Write-Output, Write-Host, etc.)
ANSWER
Answered 2020-Oct-21 at 17:04You need to assign the entire expression to a variable - otherwise any resulting output will "bubble up" to the caller and you'll see it on the screen:
QUESTION
Im looking to convert my ps1 to exe. it has to be some kind of a compiler that can accept parameters since i would like this exe file to be a bit different some times. for example i may have inside the script:
...ANSWER
Answered 2020-Jul-09 at 08:24My Solution was:
- Create Template script, whatever needed to be changed from the template mark as something like '@@@var1@@@'
- Create another script to accept variables.
- Get-content of the template script and use -repalce method to replace what is needed in the template script.
- Compile the newly created script with Ps2Exe
QUESTION
I created a fairly big PowerShell Script working with the Exce COM Object to Output Data it read into some .ini files. I converted the Script to .exe with the Win-PS2EXE Programm.
When I start the Script on my Fujitsu PC it creates and then populates the Files. When my Collegue uses it on his Lenovo, the files get created (So it can't be a filepath problem) but there isn't any data that gets written into them.
My Fujitsu
- Windows Version 10.0.017134 Build 17134 (Everything is the Same)
- PowerShell Version 5.1.17134.858 (Everything is the Same)
- All Excels fully closed
- No Clicking around when it's taking a while
- Script version 3.8
- Microsoft 360 Account with newest Excel
- Same Excel File Used
His Lenovo
- Windows Version 10.0.017134 Build 17134 (Everything is the Same)
- PowerShell Version 5.1.17134.858 (Everything is the Same)
- All Excels fully closed
- No Clicking around when it's taking a while
- Script version 3.8
- Microsoft 360 Account with newest Excel
- Same Excel File Used
The Script itself works. It was tested and debugged over multiple Months and it always worked (on multiple, different systems) with no Errors. Where could the problem be or what could I try to do?
...ANSWER
Answered 2020-Mar-30 at 08:55So, I don't know why or how, but the Excel itself is broken after I transfer it to his PC. (All Permissions etc. are set so that the excel works and everything.)
I copied the Data in the Excel into a new Excel File, which I transferred the same way again (Network Folders). This time it worked.
All in all, the Excel File itself has some Corruption. I may look into it and if I find a Solution I'm going to post it here.
For now I know the Script has no Error and works on all other Systems.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PS2EXE
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page