简体   繁体   中英

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?

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:

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM