我喜欢命令提示符绿色的字体。

解决方案 »

  1.   

    Linux/Unix下倒是很简单一个命令
    windows下还真不知道
      

  2.   

    .NET 2.0 的 Console 类可以改颜色1.1 没门
      

  3.   

    .NET1.1是没门的。改你操作系统的字体颜色。嘿嘿。
      

  4.   

    .NET 1.1中可以调Windows API SetConsoleTextAttribute来实现,具体代码如下: class GreenConsoleMain
    {
            [DllImport("kernel32.dll", EntryPoint="SetConsoleTextAttribute")]
            static public extern bool SetConsoleTextAttribute( int hConsoleOutput, short  wAttributes );
            
            [DllImport("kernel32.dll", EntryPoint="GetStdHandle")]
            static public extern int GetStdHandle( int nStdHandle );        [DllImport("kernel32.dll", EntryPoint="SetConsoleTitle")]
            static public extern bool SetConsoleTitle( string title );        const int STD_INPUT_HANDLE = -10;          // standard input handle
            const int STD_OUTPUT_HANDLE = -11;         // standard output handle
            const int STD_ERROR_HANDLE = -12;          // standard error handle        const short FOREGROUND_BLUE      = 0x0001; // text color contains blue.
            const short FOREGROUND_GREEN     = 0x0002; // text color contains green.
            const short FOREGROUND_RED       = 0x0004; // text color contains red.
            const short FOREGROUND_INTENSITY = 0x0008; // text color is intensified.
            const short BACKGROUND_BLUE      = 0x0010; // background color contains blue.
            const short BACKGROUND_GREEN     = 0x0020; // background color contains green.
            const short BACKGROUND_RED       = 0x0040; // background color contains red.
            const short BACKGROUND_INTENSITY = 0x0080; // background color is intensified. /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
                int nStdHandle = GetStdHandle( STD_OUTPUT_HANDLE );
                
                bool bRet = SetConsoleTitle( "A green window" );
                bRet = SetConsoleTextAttribute( nStdHandle, FOREGROUND_GREEN );            Console.WriteLine( "Look at the fonts." );
                string result = Console.ReadLine();
    }
    }
    .NET 2.0中Console类就直接支持改颜色
      

  5.   

    看来问题已经解决了,再提一个,以前DOS时代的东东
    prompt