解决方案 »

  1.   

    http://www.cnblogs.com/jailu/archive/2007/07/22/827058.html
      

  2.   


    System.Diagnostics.Process.Start("cmd.exe", "/K echo y format B:");  // don't try it ;-) 
      

  3.   

    = =...楼上那个是用process执行cmd命令...和楼主要的不太一致吧...
      

  4.   

    至少我没有写format c: 现在几乎都没有A/B盘了。教训就是,要运行任意代码就要有控制权限的思想准备。
      

  5.   

    至少我没有写format c: 现在几乎都没有A/B盘了。教训就是,要运行任意代码就要有控制权限的思想准备。一般不都是有提示的么?这个没提示?
      

  6.   

    /* 
    // 使用 C# 动态编译代码和执行 
    static void Main(string[] args) 

    // 编译器 
    CodeDomProvider cdp = CodeDomProvider.CreateProvider("C#"); // 编译器的参数 
    CompilerParameters cp = new CompilerParameters(); 
    cp.ReferencedAssemblies.Add("System.dll"); 
    cp.GenerateExecutable = false; 
    cp.GenerateInMemory = true; // 编译结果 
    CompilerResults cr = cdp.CompileAssemblyFromSource(cp, HelloWorld()); if (cr.Errors.HasErrors) Console.WriteLine("编译出错!"); 
    else 

    // 编译后的程序集 
    Assembly ass = cr.CompiledAssembly; // 得到HelloWorld类中的SayHello方法 
    Type type = ass.GetType("HelloWorld.HelloWorld"); 
    MethodInfo mi = type.GetMethod("SayHello"); // 执行 
    mi.Invoke(null, null); 

    } // 动态构建的代码 
    static string HelloWorld() 

    StringBuilder sbCode = new StringBuilder(); 
    sbCode.AppendLine("using System;"); 
    sbCode.AppendLine("namespace HelloWorld"); 
    sbCode.AppendLine("{"); 
    sbCode.AppendLine(" class HelloWorld"); 
    sbCode.AppendLine(" {"); 
    sbCode.AppendLine(" public static void SayHello()"); 
    sbCode.AppendLine(" {"); 
    sbCode.AppendLine(" Console.WriteLine(\"Hello~ World~!\");"); 
    sbCode.AppendLine(" }"); 
    sbCode.AppendLine(" }"); 
    sbCode.AppendLine("}"); 
    return sbCode.ToString(); 
      

  7.   


    命令行有个管道符 |,可以把y当成输入:
    echo y | formatXXX C:
      

  8.   


    命令行有个管道符 |,可以把y当成输入:
    echo y | formatXXX C:还打C盘主意?D盘才可能执行成功
      

  9.   

    至少我没有写format c: 现在几乎都没有A/B盘了。教训就是,要运行任意代码就要有控制权限的思想准备。
    +1
    让不太懂技术,只懂业务的最终用户随便执行代码,是一件很可怕的事情
    如果是要做开发工具,还是从底层开始做吧,用高级语言做开发工具,开发出来的东西还是跳不出高级语言的框架
      

  10.   

    额,你要不是C# 而是powershell
      

  11.   

    显示TextBox的多行文本
    //实现方法如下
     private void btn_OK_Click(object sender, EventArgs e)
            {
                txt_Change.Location = new Point(0, 0);//设置文本框位置
                txt_Change.Multiline = true;//设置文本框显示多行
                txt_Change.Width = //设置文本框宽度
                    this.Width;
                txt_Change.Height = //设置文本框高度
                    ClientRectangle.Height - btn_OK.Height-15;
            }
      // 使用代码编辑器修改此方法的内容。
                   private void InitializeComponent()
            {
                this.btn_OK = new System.Windows.Forms.Button();
                this.txt_Change = new System.Windows.Forms.TextBox();
                this.SuspendLayout();
                // 
                // btn_OK
                // 
                this.btn_OK.Location = new System.Drawing.Point(103, 92);
                this.btn_OK.Name = "btn_OK";
                this.btn_OK.Size = new System.Drawing.Size(121, 23);
                this.btn_OK.TabIndex = 0;
                this.btn_OK.Text = "转换为多行文本框";
                this.btn_OK.UseVisualStyleBackColor = true;
                this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
                // 
                // txt_Change
                // 
                this.txt_Change.Location = new System.Drawing.Point(103, 47);
                this.txt_Change.Name = "txt_Change";
                this.txt_Change.Size = new System.Drawing.Size(121, 21);
                this.txt_Change.TabIndex = 1;
                // 
                // Frm_Main
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(332, 127);
                this.Controls.Add(this.txt_Change);
                this.Controls.Add(this.btn_OK);
                this.Name = "Frm_Main";
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                this.Text = "制作多行文本框";
                this.ResumeLayout(false);
                this.PerformLayout();        }
      

  12.   

    至少我没有写format c: 现在几乎都没有A/B盘了。教训就是,要运行任意代码就要有控制权限的思想准备。
    +1
    让不太懂技术,只懂业务的最终用户随便执行代码,是一件很可怕的事情
    如果是要做开发工具,还是从底层开始做吧,用高级语言做开发工具,开发出来的东西还是跳不出高级语言的框架
    +1
      

  13.   

    C# Code Compiler,google 这个