cm_ExecutePowerShell
Moderators: Hacker, petermad, Stefan2, white
cm_ExecutePowerShell
Would such an internal command (cm_ExecutePowerShell) be useful? Perhaps it would be. Recently i have installed MS's new powershell (v7) and it would be nice if there was such a command in TC, which would find the latest version installed on the PC and execute it...
I don't know how easy this would be, if there is perhaps a registry setting pointing to the latest ps version, but IMO it would be useful.
I don't know how easy this would be, if there is perhaps a registry setting pointing to the latest ps version, but IMO it would be useful.
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
Re: cm_ExecutePowerShell
What is the problem to make a button for users which are interested on Powershell.
If they can't do that it makes no sense to learn or use Powershell
If they can't do that it makes no sense to learn or use Powershell

Code: Select all
TOTALCMD#BAR#DATA
C:\Program Files\PowerShell\7\pwsh.exe
-NoExit
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
PowerShell in current path
0
-1
Windows 11 Home, Version 24H2 (OS Build 26100.4061)
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
TC 11.55 RC2 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.4 x64
Re: cm_ExecutePowerShell
Well, the "problem" would be that in every new version they release, the path will change (C:\Program Files\PowerShell\7, 8, 9, etc...) and if you want the latest version, you will have to change the button every time. On one PC, you will say "oh well, ok, let's do it", but who works on one PC only these days...Horst.Epp wrote: 2021-04-29, 15:19 UTCWhat is the problem to make a button for users which are interested on Powershell.
If they can't do that it makes no sense to learn or use Powershell![]()

- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
Re: cm_ExecutePowerShell
Well, you could still write some script (e.g. Batch, AHK, AutoIt, VBS) that determines the thing you need (the version number) and launches PowerShell afterwards.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: cm_ExecutePowerShell
Of course, but it would be cleaner if it existed in TC (if there's a straight-forward way).
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
Re: cm_ExecutePowerShell
Hmmm, ok, the usual MS mess...
HKLM\SOFTWARE\Microsoft\PowerShell\1
HKLM\SOFTWARE\Microsoft\PowerShell\3
HKLM\SOFTWARE\Microsoft\PowerShellCore\InstalledVersions\31ab5147-9a97-4452-8443-d9709f0516e1\SemanticVersion = 7.1.3
HKLM\SOFTWARE\Microsoft\PowerShellCore\ProgramsMenuShortcut\7\installed = 1
A different method in each version. Great... :/ Not to mention the different installation paths...
HKLM\SOFTWARE\Microsoft\PowerShell\1
HKLM\SOFTWARE\Microsoft\PowerShell\3
HKLM\SOFTWARE\Microsoft\PowerShellCore\InstalledVersions\31ab5147-9a97-4452-8443-d9709f0516e1\SemanticVersion = 7.1.3
HKLM\SOFTWARE\Microsoft\PowerShellCore\ProgramsMenuShortcut\7\installed = 1
A different method in each version. Great... :/ Not to mention the different installation paths...
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
- sqa_wizard
- Power Member
- Posts: 3893
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
Re: cm_ExecutePowerShell
Just do it the smart way, quick and dirty:
Code: Select all
TOTALCMD#BAR#DATA
powershell
shell32.dll,34
Powershell
-1
#5767 Personal license
Re: cm_ExecutePowerShell
Hmmm... I just tried it and it loaded the newest version. Is it guarantied that it will always do so?
EDIT: The more strange thing is that in the path, powershell 1.0 appears before powershell 7...
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
Re: cm_ExecutePowerShell
Me think yes.
Check your registry for
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\PowerShell.exe
I have (on w10) still the old default since win7
%SystemRoot%\system32\WindowsPowerShell\v1.0\PowerShell.exe
What do you have there?
Re: cm_ExecutePowerShell
%SystemRoot%\system32\WindowsPowerShell\v1.0\PowerShell.exe
(the same). Typing "powershell" in a command prompt executes the old one. Typing the same in search, fetches the new one (first). It doesn't seem consistent...
- Wanderer -
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.