Script Packager PowerShell v5.1 Host

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 1 day old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Pwnisher1337
Posts: 8
Last visit: Wed Aug 24, 2022 12:35 am

Script Packager PowerShell v5.1 Host

Post by Pwnisher1337 »

Hi,

I'm trying to overcome the "File Path too Long" Limit by using PowerShell Version 5.1 where you can add \\?\UNC\ in front of a Path. For Example:

Code: Select all

$FolderPath = "\\?\UNC\FilerServer\Folder\SubFolder\"
Get-ChildItem -LiteralPath $FolderPath -Filter "*.lnk" -Recurse
Which works perfect if i run it in a Shell with PS V5.1, but it doesn't work in the GUI i'm working on since it's only a Host with Version 5.0. so i get the Error:

Code: Select all

Get-ChildItem : Illegal characters in path.
How to do i get the Script Packager to Build the Project i'm working on to PS V5.1 Hosts?

Studio Version:
PowerShell Studio 2018 v5.5.148 / Win 10 x64

Code: Select all

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Script Packager PowerShell v5.1 Host

Post by davidc »

[TOPIC MOVED TO POWERSHELL GUIS FORUM FORUM]

It probably has to do with the current directory of the console / packager executable and with not with the fact that it is a GUI or a packaged executable.

Try using the FileSystem specifier:

"FileSystem::\\FilerServer\Folder\SubFolder\"
David
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script Packager PowerShell v5.1 Host

Post by jvierra »

Long path names does not work with shares. It works only with physical drives. The "\\?" is a physical device specifier which is why we must use "LiteralPath".
This topic is 6 years and 1 day old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked