Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

MyPShell - Demonstration of a Take Command Console Plugin written in C++/CLI

Aug
2,831
149
Continued from C++ and PowerShell

Demonstration of a Take Command Console Plugin written in C++/CLI

This is NOT a finished product.

The plugin allows running PowerShell Commands and Files

Examples;
Code:
E:\...\MyPShell>#MyPShell u:\flow.ps1
2022
2.99186

Code:
E:\...\MyPShell>#MyPShell get-date;2025-1963
2025-12-11 11:21:47 AM
62

I build the MyPShell.dll from the command line;
Code:
MSBuild.exe MyPShell.vcxproj /p:Configuration=Release /p:Platform=x64

Notes:
  • Unlike the TCC PShell command, MyPShell is not persistent.
  • I use this on my Windows 10 system with TCC v35.
  • I am not a C++ expert, nor am I a C++/CI expert.
  • This was built with .NET Framework
  • Feel free to improve on this plugin.
  • MyPShell.cpp source code included.
Github Repo: GitHub - joec4281/MyPShell: Demonstration of a Take Command Console Plugin written in C++/CLI that allows running PowerShell Command and Files

Joe
 
Last edited:
Too ignorant of PowerShell to ask intelligent questions, but: Is the # sign part of your command name? That's unusual. In fact it's so unusual that I'll bet you could abbreviate the whole command down to just the #.
 
The # is part of my prompt.

When I run this alias;
Code:
setl is an alias : @if %_batch eq 0 (*setlocal & set localcount=%@inc[0%localcount%])

...the prompt becomes;
Code:
E:\Utils>set prompt
$e[9999E$w$g%@repeat[#,0%localcount]

...which lets me know I can back-out of this environment,
and return to my previous environment.

Once I have run the setl alias,
I run the VC64 alias;
Code:
E:\Utils>which vc64
vc64 is an alias : "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

...so that I can run MSBuild.

Joe
 
Back
Top