1

我想借助 system32 文件夹中的 schtasks.exe 将计划任务添加到 Windows 任务计划程序。

我在 aspx.cs 页面中按以下方式进行操作:

        Process proc = new Process();
        proc.StartInfo.UseShellExecute = false;
        proc.StartInfo.FileName = @"C:\Windows\System32\schtasks.exe";
        proc.StartInfo.Arguments = "/create /tn mylbat /tr MYLExe.exe /sc daily /st " + txthh.Text + ":" + txtmm.Text;
        proc.StartInfo.RedirectStandardError = true;
        proc.StartInfo.RedirectStandardOutput = true;
        proc.StartInfo.CreateNoWindow = false;
        proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
        proc.Start();
        proc.WaitForExit();

但是在 ascx.cs 文件中同样不起作用。我需要在 Process 对象中设置任何参数吗?

编辑我:

相同的 ascx 在正常的 asp 站点中工作,但在 Ektron 站点中不工作。我也想将它作为小部件添加到 Ektron 8.0 的智能桌面中。

该站点托管在 IIS 中。

站点在IIS上运行时进程和exe SCHTASKS.exe的参数应该是什么

4

0 回答 0