You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please Start Versioning PowerShell.exe (So The latest version can be found by Get-Command) #5166
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.
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.
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)
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?
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.
Activity
iSazonov commentedon Oct 19, 2017
It seems dup #4836 - we can discuss there.
DarwinJS commentedon Oct 19, 2017
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 commentedon Oct 20, 2017
#4836 is different. I think I can take care of this one and the icon one at the same time.
iSazonov commentedon 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 commentedon 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 commentedon Oct 21, 2017
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 commentedon 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 commentedon Oct 21, 2017
Steve Lee (@SteveL-MSFT) - thanks for clarifying! I was thinking it was being offered as a permanent alternative.
iSazonov commentedon Oct 22, 2017
I found SMA.dll idea in VS Code repo - they use that to enumerate PowerShells on all platforms.
use rcedit to embed icon and version information into pwsh.exe (#5178)
use rcedit to embed icon and version information into pwsh.exe (Power…