zoukankan      html  css  js  c++  java
  • C# 代码处理文件"解除锁定"

           cmd = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "streams64.exe") + "-d "C:\Users\Dxn2\Desktop\致贞审计作业平台20201030.rar"" + "&exit";
                using (Process p = new Process())
                {
                    string cmdPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "cmd.exe");
                    p.StartInfo.FileName = "cmd.exe";
                    p.StartInfo.Arguments = "/c " + cmdPath;
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardError = true;
                    p.StartInfo.RedirectStandardInput = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.CreateNoWindow = true;
                    p.StartInfo.Verb = "RunAs";
                    p.Start();
                    p.StandardInput.WriteLine(cmd);
                    p.StandardInput.AutoFlush = true;
                    output = p.StandardOutput.ReadToEnd();
                    p.WaitForExit();//等待程序执行完,退出进程
                    p.Close();
                }

    -d 针对文件或文件夹执行

    -s -d 可以递归执行文件夹下的子文件子文件夹

    参考内容:

    https://bbs.csdn.net/topics/392176119?list=30947593

    https://docs.microsoft.com/zh-cn/sysinternals/downloads/streams

  • 相关阅读:
    深入理解iOS开发中的锁
    整理:iOS开发算法资料
    (二)ELK Filebeat简介
    (一)ELK 部署
    zabbix + grafana 展示
    (二)LVS介绍
    (一)集群介绍
    zabbix 监控 ESXI
    zabbix proxy 安装
    zabbix fping 监控网络质量
  • 原文地址:https://www.cnblogs.com/JqkAman/p/14061308.html
Copyright © 2011-2022 走看看