谁帮忙解决下ASP.NET的bat批处理的问题

来源:互联网 发布:部落冲突九本科技数据 编辑:程序博客网 时间:2024/05/18 02:16

在ASP.NET尝试了很多方法都没解决BAT批处理的问题,有那位高手帮忙一下.

下面是源代码:

C#:

 public partial class a : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        //Process proc = new Process();

       // System.Diagnostics.Process.Start("cmd.exe /c cmdtest.bat","9999");

       System.Diagnostics.Process.Start("cmd.exe" + " /c " + "cmdtest.bat " + "9999");  
 
       // proc.WaitForExit();

    }
}

或者:

 protected void Page_Load(object sender, EventArgs e)
    {
        
     Process proc = new Process();


      //  System.Diagnostics.Process.Start("cmd.exe" + " /c " + "D://aaa//demo.bat");

      //  System.Diagnostics.Process = System.Diagnostics.Process.Start("cmd.exe", " /c " + "D://aaa//demo.bat");
     //   proc.WaitForExit();

 


        //proc.StartInfo.Arguments ="ffmpeg -i " + avs + " " + outFile;

     // proc.StartInfo.Arguments = "c/ demo.bat";

    //   proc.Start();

       // proc.Start("cmd.exe", "/c TEST3.BAT A");

       // System.Diagnostics.Process.WaitForExit();

      //  proc.WaitForExit();

    //  proc.UseShellExecute = true;
    //  proc.CreateNoWindow = false;
    //  proc.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;

    //  System.Diagnostics.Process.Start(proc);           


    }

VB.NET:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Dim proc As System.Diagnostics.Process
        'proc = System.Diagnostics.Process.Start("cmd.exe", " /c " & "name.bat")
        ' proc.WaitForExit()


        '  Dim WSH = Server.CreateObject("WScript.Shell")   '建立一个wscript.shell对象  

        ' Dim RTL = WSH.Run("D:/aaa/name.bat", 1, True)

        'If RTL = 0 Then
        'Response.Write("OK")
        'Else
        'Response.Write("ERR")
        'End If


        Shell("cmd.exe /c name.bat")

        'Shell("cmd.exe /c D:/aaa/name.bat", AppWinStyle.NormalFocus)

        ' Dim p As New System.Diagnostics.Process
        '  p.StartInfo.FileName = "cmd.exe"
        ' p.StartInfo.Arguments = " /c " & "D:/aaa/demo.bat"
        '  p.StartInfo.UseShellExecute = False
        '  p.StartInfo.RedirectStandardInput = True
        '  p.StartInfo.RedirectStandardOutput = True
        '  p.StartInfo.RedirectStandardError = True
        '   p.StartInfo.CreateNoWindow = False
        '  p.Start()

        '  Dim strValue As String = p.StandardOutput.ReadToEnd()


        ' Server.CreateObject("WSCRIPT.SHELL").run(Server.MapPath("name.bat"))

有很多代码我加了注解没去掉的.

 

 

原创粉丝点击