Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 546

PowerShell GUIs • Re: GUI package as exe - files not found

$
0
0
When getting the path after packaging, you may find the following function helpful:

Code:

function Get-ScriptDirectory
{
<#
.SYNOPSIS
Get-ScriptDirectory returns the proper location of the script.

.OUTPUTS
System.String

.NOTES
Returns the correct path within a packaged executable.
#>
[OutputType([string])]
param ()
if ($null -ne $hostinvocation)
{
Split-Path $hostinvocation.MyCommand.path
}
else
{
Split-Path $script:MyInvocation.MyCommand.Path
}
}

Statistics: Posted by brittneyr — Mon Apr 22, 2024 7:45 am



Viewing all articles
Browse latest Browse all 546

Trending Articles