c# .net how do I convert a console app to be a power shell program?

c# how do I convert a console app to be a power shell program?
Who is Participating?
jgordosConnect With a Mentor Commented:
I mean, if all you want to do is run the program like you do from the command line now, all you have to do is run it... like from a batch file.

i mean...

Pretend you have a .net "Hello World!" console application, and the compiled executable is  called "hello.exe"

All I do is give powershell scripts a full path to the object...


I create a wrapper script called "runme.ps1"

the only thing in the file is:


And from a command prompt (normal windows command prompt)

powershell .\runme.ps1

And it all runs...

Hope this helps,
Is the console application a .net application you wrote?

I mean, is it a C# console application with a main() that has an extension of ".exe"?

jackjohnson44Author Commented:
yes, that is correct.  I run it from a dos command line
Okay, so here's the question....

Do you just want to run the existing program?


Do you want to write PowerShell programs that do the same thing as the existing program, but translated from C# to PowerShell?

or, even simplier...

powershell .\hello.exe

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.