System.Diagnostics.Process("copy aaa.html bbb.html") ???

解决方案 »

  1.   

    用API也行。
    using System.Runtime.InteropServices;[DllImport("Shell32.dll",EntryPoint="ShellExecute")]
    public static extern IntPtr ShellExecute(
        IntPtr hwnd, 
        string lpOperation,
        string lpFile, 
        string lpParameters, 
        string lpDirectory,
        int    nShowCmd
    );调用:
    ShellExecute(handle, null, path_to_folder, null, null, SW_SHOWNORMAL);or ShellExecute(handle, "open", path_to_folder, null, null, SW_SHOWNORMAL);To explore a folder, use: ShellExecute(handle, "explore", path_to_folder, null, null, SW_SHOWNORMAL);常数值可以从c++ 的Library中查到
      

  2.   

    更正一下:
    ShellExecute(this.Handle, null, path_to_folder, null, null, SW_SHOWNORMAL);or ShellExecute(this.Handle, "open", path_to_folder, null, null, SW_SHOWNORMAL);To explore a folder, use: ShellExecute(this.Handle, "explore", path_to_folder, null, null, SW_SHOWNORMAL);
      

  3.   

    project() ...5555555555看不懂。其实我就想做一个程序,比如:myexe.exe.
    他可以这样用:myexe.exe copy aaa.html bbb.html
    那么就运行 copy aaa.html bbb.html
    myexe.exe dir *.*
    那么就运行dir *.*
    555。谁帮我写这个程序呢???告诉我关键语句也行(C#)的。
      

  4.   

    File命名空间下有很多文件操作命令。你可以去看一下。如:File.Exist(string FileName)、File.Copy...
      

  5.   

    project() ,晕。我不是要copy。那只是一个例子!!就是运行时直接调用dos命令就行。!!比如:
    myexe dir *.*
    myexe rename bbb.asp ccc.bac
    myexe md aaa
    之类的。
      

  6.   

    就是运行时直接调用dos命令就行。!!批处理不久解决?
      

  7.   

    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo.FileName = "COMMAND";  //win98
    proc.StartInfo.Arguments = "/C TYPE " + strFilePath + " > PRN";
    proc.Start();
    proc.WaitForExit();
    proc.Dispose();
      

  8.   

    可以把命令写入一个批处理文件比如在D盘根目录下存为test.bat
    c#中添加引用C:\WINNT\System32\wshom.ocxWshShellClass obj=new WshShellClass();
    obj.Exec("d:\\test.bat");就可执行文件中的一系列DOS命令
      

  9.   

    你不就是为了操作文件吗
    用system.io.file or system.io.fileinfo
    不就完了!
      

  10.   

    System.Diagnostics.Process xx = new System.Diagnostics.Process();
    xx.StartInfo.FileName="ping.exe";
    xx.StartInfo.Arguments ="www.sina.com.cn";
    xx.StartInfo.UseShellExecute=false;
    xx.StartInfo.CreateNoWindow = true;
    xx.StartInfo.RedirectStandardOutput = true;
    xx.Start();
    xx.WaitForExit();
    System.Windows.Forms.MessageBox.Show(  xx.StandardOutput.ReadToEnd());
      

  11.   

    Process类似乎不能够调用内部命令吧?
      

  12.   

    .net框架里面有一个file 和 fileinfo 类,这个类就能实现你向有关的文件操作。你可以查一下msdn,也可以查看一下《c#入门经典》或《c#高级编程》。
      

  13.   

    System.Diagnostics.Process.Start("notepad.exe");