The 'Microsoft.PowerShell.Core' in Get-Location is expected PowerShell behavior
Check this:
https://community.idera.com/database-to ... hell-paths
Also, If you can, please zip and load up the original psf file, so that we can attempt to recreate the issue using your file:
https://www.sapien.com/support/upload
not getting output from msgbox
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- ocsscott6969
- Posts: 48
- Last visit: Tue Dec 05, 2023 10:04 am
Re: not getting output from msgbox
im about to upload uncomment line 53-65 to see the behavior the first sections for $a and $b
the code for $C is working but previously the $a code was what you suggested I use.
thanks
the code for $C is working but previously the $a code was what you suggested I use.
thanks
Re: not getting output from msgbox
We have been able to reproduce the problem you are having with getting values from PSScriptRoot and PSCommmandPath not returning anything when packaged. The issue has been sent to the proper place for evaluation and correction. When a fix is issued with a service build, it will be listed in the change log.
We apologize for any inconvenience.
We apologize for any inconvenience.
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: not getting output from msgbox
$PSScriptRoot and $PSCommandPath are filled where possible as a convenience to users. You must keep in mind though that packaged code does not run as a script.
It is executed as code in a custom host. So there are some differences to keep in mind and PowerShell is likely getting confused as to the scope of these variables.
Which is why they show up empty rather than producing an error.
Please refer to: https://www.sapien.com/blog/2009/09/02/ ... nvocation/
The proper way to reliably determine the path of a script and likewise that of the underlying executable executable in a script package is as follows:
function get-scriptdirectory{
if($hostinvocation -ne $null) {
Split-Path $hostinvocation.MyCommand.path
}
else {
$invocation=(get-variable MyInvocation -Scope 1).Value
Split-Path $invocation.myinvocation.path
}
}
Calling this function will return the correct path whether the code is run as a script file or if it is packaged as an executable file.
It is executed as code in a custom host. So there are some differences to keep in mind and PowerShell is likely getting confused as to the scope of these variables.
Which is why they show up empty rather than producing an error.
Please refer to: https://www.sapien.com/blog/2009/09/02/ ... nvocation/
The proper way to reliably determine the path of a script and likewise that of the underlying executable executable in a script package is as follows:
function get-scriptdirectory{
if($hostinvocation -ne $null) {
Split-Path $hostinvocation.MyCommand.path
}
else {
$invocation=(get-variable MyInvocation -Scope 1).Value
Split-Path $invocation.myinvocation.path
}
}
Calling this function will return the correct path whether the code is run as a script file or if it is packaged as an executable file.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- ocsscott6969
- Posts: 48
- Last visit: Tue Dec 05, 2023 10:04 am