Alexander Popov
Alexander Popov

Reputation: 24875

Executing C# in command prompt (cmd)

Python allows the following: once I open cmd I can start python and then run python commands which return results directly in cmd. For example, I type print word and cmd returns word. Is there a similar thing for C# or the only way to execute C# code is to write it in a file and then compile it?

Upvotes: 2

Views: 306

Answers (1)

Adrian Salazar
Adrian Salazar

Reputation: 5319

Use PowerShell.

This will allow you to access the objects in the .Net Framework as well the objects in the operating system.

Check this simple example:

enter image description here

Or you can check this advanced example:

http://blogs.technet.com/b/stefan_gossner/archive/2010/05/07/using-csharp-c-code-in-powershell-scripts.aspx

Upvotes: 5

Related Questions