GeezerVison is showing github.com — Please Start Versioning PowerShell.exe (So The latest version can be found by Get-Command) · Issue #5166 · PowerShell/PowerShell
Please Start Versioning PowerShell.exe (So The latest version can be found by Get-Command) #5166DescriptionCan't do the following from openssh installer to find the latest powershell core.
get-command "c:\program files\PowerShell*\PowerShell.exe"
So the weird thing is to do the same thing for any other default shell candidate from third parties - this would likely work - to, for instance, find the latest bash.exe
I can do a work around by using the versioned folder for now - but that only handles the default install location where the methodology of a versioned folder is followed by convention. If someone drops it in another folder or I try get-command against the file unpathed - I won't find a version.
There are obviously a lot of other reasons this should be done - just giving light to a very practical and current scenario. Reacted by Mikey Lombardi (He/Him) ActivityiSazonov commented on Oct 19, 2017 It seems dup #4836 - we can discuss there. DarwinJS commented on Oct 19, 2017 ContributorAuthor More actions It is not really a duplicate - getting a version number to compile into the PE header should be a couple compiler settings. Additionally, you could have an exe emit it's version without coding the PE header.
Both ways should be probably enabled, but importantly, the PE header can be examined without running the EXE. SteveL-MSFT commented on Oct 20, 2017 #4836 is different. I think I can take care of this one and the icon one at the same time. iSazonov commented on Oct 21, 2017 The issue for Windows only. If we'll think about portability it is better to be based on SMA.dll to get a version by Get-Command. SteveL-MSFT commented on Oct 21, 2017 Darwin (@DarwinJS) what Ilya (@iSazonov) has found is that SMA.dll has file version information already with PSCore6 even on non-Windows. Since that is a core dll that will always be there with PowerShell, you can rely on it (with the exception of Windows PowerShell where SMA.dll is in the GAC and not in $PSHOME) DarwinJS commented on Oct 21, 2017 ContributorAuthor More actions I appreciate the tip. It would be great if it could be right in the EXEs like you all did with openssh.
For instance, I was working on the ability for the openssh package to probe for which exe to use for the DefaultShell. By the time I got it done, I realized I would need to make sure they can only choose an EXE and should not be allowed to have any wildcards in the file name so that they are always going for a know file name and don't pickup unintention EXEs.
Just wanted to give light to a use case where having it actually in the exe is not only what is generally expected on Windows - in this case it avoids custom code to go find the version for an EXE by looking in a DLL.
Is it somehow more challenging to do it for powershell than it was for openssh? SteveL-MSFT commented on Oct 21, 2017 Darwin (@DarwinJS) I have a PR opened for pwsh.exe on Windows, Ilya (@iSazonov)'s comment is that checking the version of pwsh.exe only works on Windows while checking version of SMA.dll works on all platforms. DarwinJS commented on Oct 21, 2017 ContributorAuthor More actions iSazonov commented on Oct 22, 2017 I found SMA.dll idea in VS Code repo - they use that to enumerate PowerShells on all platforms. added a commit that references this issue on Oct 27, 2017This issue will close once commit 4df7036 is merged into the 'master' branch.4df7036 added a commit that references this issue on Aug 6, 2026This issue will close once commit 9e0434e is merged into the 'master' branch.9e0434e
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|