COMM/HxCOMM.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Web;
using System.Net;
using System.Diagnostics;
namespace COMM
{
public class HxCOMM
{
//创建bat文件需要引用类库 using System.Diagnostics ;
public static void createbat(string foldName,string filename)
{
string v_filepath;
string v_s1, v_s2,v_s3,v_s4;
// v_filepath = "F:\\批处理任务\\" + filename;
v_filepath = HttpContext.Current.Server.MapPath("~/content/upload/fiels/" + foldName+"/"+filename);
// 判断 bat文件是否存在,如果存在先把文件删除
if (System.IO.File.Exists(v_filepath))
System.IO.File.Delete(v_filepath);
// 成功样板
string s = string.Empty; //显示目录列表
s += "ren *.tbi *.jpg"; //
File.WriteAllText(v_filepath, s, Encoding.Default); //将s字符串的内容写入v_filepath指定的bat文件中。
}
//C# 调用执行bat批处理文件
public static void RunBat(string foldName, string filename)
{
Process pro = new Process();
FileInfo file = new FileInfo(filename) ;
pro.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath("~/content/upload/fiels/" + foldName +"/");
pro.StartInfo.FileName = filename;
pro.StartInfo.CreateNoWindow = false;
pro.Start();
pro.WaitForExit();
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。