Solved

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

Posted on 2010-08-12
5
567 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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