右键菜单修改文件名日期工具

右键菜单工具:批量把文件名后面8位的日期修改成今天的日期

谢谢~~

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

namespace Q695220
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Count() == 0) return;
            string org = args[0] = Path.GetFullPath(args[0]);
            string dt = DateTime.Now.ToString("yyyyMMdd");
            if (Regex.IsMatch(args[0], "\\d{6}"))
                args[0] = Regex.Replace(args[0], "\\d{6}", dt);
            else
                args[0] = Path.GetDirectoryName(args[0]) + "\\" + Path.GetFileNameWithoutExtension(args[0]) + dt + Path.GetExtension(args[0]);
            Console.WriteLine(org);
            Console.WriteLine(args[0]);
            File.Move(org, args[0]);
        }
    }
}

图片说明

首先在注册表

 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Q695220\Command

下面加上一个字符串,你的exe的路径.exe %1

完整的源代码和可执行文件:https://download.csdn.net/download/caozhy/10552599