Solved

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

Posted on 2010-08-12
5
562 Views
Last Modified: 2013-12-17
c# how do I convert a console app to be a power shell program?
0
Comment
Question by:jackjohnson44
  • 4
5 Comments
 
LVL 11

Expert Comment

by:jgordos
ID: 33421079
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"?

-john
0
 

Author Comment

by:jackjohnson44
ID: 33421139
yes, that is correct.  I run it from a dos command line
0
 
LVL 11

Expert Comment

by:jgordos
ID: 33422121
Okay, so here's the question....

Do you just want to run the existing program?

Or

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

-john
0
 
LVL 11

Accepted Solution

by:
jgordos earned 500 total points
ID: 33422270
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...

like

I create a wrapper script called "runme.ps1"

the only thing in the file is:

C:\test\hello.exe

And from a command prompt (normal windows command prompt)

powershell .\runme.ps1

And it all runs...

Hope this helps,
-john
0
 
LVL 11

Expert Comment

by:jgordos
ID: 33422280
or, even simplier...

powershell .\hello.exe


-john
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now