@echo off
rem 指定文件夹路径
set fd=D:\下载的图片
rem 0为转换文件名,1为转换文件夹名,2为同时转换文件名和文件夹名
set f=0 rem 0为不包括子文件夹,1为包括子文件夹
set r=
rem 2为繁转简,4为简转繁
set n=
set locale=[System.Globalization.Cultureinfo]::CurrentCulture.LCID
if "%fd:~-1%" equ "\" set "fd=%fd:~,-%"
if "%r%" equ "" (set r=-r) else set "r="
if "%f%" equ "" (set "f=$_.PSIsContainer -eq $false") else (
if "%f%" equ "" (set "f=$_.PSIsContainer -eq $true") else set "f=1 -eq 1"
) powershell ^
\">> %fd%`r`n\"+('-'*45);^
$cs='^
using System;^
using System.Runtime.InteropServices;^
public static class ToConvert^
{^
[DllImport(\"kernel32\", CharSet = CharSet.Unicode, SetLastError = true)]^
public static extern int LCMapString(int Locale, int dwMapFlags, string lpSrcStr, int cchSrc, string lpDestStr, int cchDest);^
}';^
Add-Type -TypeDefinition $cs;^
ls -Path '%fd%' %r%^|?{%f%}^|sort {$_.FullName.Length} -des^|^
%%{$scr=$_.Name;$len=$scr.Length;$des=' '*$len;^
[ToConvert]::LCMapString(%locale%, 0x0%n%, $scr, $len, $des, $len)^|out-null;^
if($scr -ne $des){^
$fd=[IO.Directory]::GetParent($_.FullName).FullName+'\';^
$newname=$fd+$des;^
$n=;^
while(Test-Path -LiteralPath $newname)^
{^
$n++;^
if($_.PSIsContainer){^
$newname=$fd+$des+'_'+$n;^
}else{^
if($des -match '(.+)(\.[^^\.]+$)'){$tmp=$matches[]+'_'+$n+$matches[]}else{$tmp=$des+'_'+$n}^
$newname=$fd+$tmp;^
}^
}^
mv -literalpath $_.FullName $newname;^
if(Test-Path -LiteralPath $_.FullName){$ts='*转换失败,需手动重命名';}else{$ts=$newname.Split('\')[-1];}^
$_.FullName.ToLower().replace('%fd%'.ToLower(),'')+' ==^> '+$ts;^
}^
}
pause

文件名简体转繁体bat的更多相关文章

  1. Python 汉字简体和繁体的相互转换

    其实利用python实现汉字的简体和繁体相互转早有人做过,并发布到github上了,地址:https://github.com/skydark/nstools/tree/master/zhtools ...

  2. bing 输入法,切换简体、繁体快捷键与myeclipse 格式化代码冲突。。

    bing 输入法,切换简体.繁体快捷键与myeclipse 格式化代码冲突...蛋碎 myeclipse 代码格式化快捷键是:ctrl+shift+F,bing输入法简体.繁体切换也是,于是蛋疼的事情 ...

  3. .net 简体转换繁体实例,繁体转换简体 Encode.dll、下载

    在项目中先引用Encode.dll  下面是下载地址: Encode.dll ChineseConverter.dll 1.html页面代码 <%@ Page Language="C# ...

  4. 简体和繁体加起来有六七万个汉字,所以Unicode只能排除一些几乎不用的汉字,Unicode编码的熟悉与研究过程(内附全部汉字编码列表)

    我有一个问题是:是不是会有个别汉字无法在Unicode下表示,这种情况下就不能完全显示了? 各种编码查询表:http://bm.kdd.cc/ ---------------------------- ...

  5. Scrapy中将item字段转为简体or繁体

    1. 安装hanziconv安装一个简繁体转换的包: pip install hanziconv 2. 自定义一个itempiples找到项目中的pipelines.py文件 添加自定义的pipeli ...

  6. Windows 8.1 with Update MSDN 简体/英文/繁体

    PS:请不要使用离线下载,以免镜像损坏! 1.CN: 文件名:cn_windows_8.1_enterprise_with_update_x64_dvd_4048578.isoSHA1:2D9BFE9 ...

  7. [函數] Firemonkey 各平台 "简体" / "繁体" 判断

    目前的 Delphi 10 Seattle 的 TLang 尚不支持取得简体及繁体的语系字符,在能取得正确的语系字符后(整理中),才能使用下列函数判断: function ChineseLang(co ...

  8. c#简体繁体转换

     方法一已经亲测,使用正常,方法二貌似不能用. 方法一 /// <summary> /// 中文字符工具类 /// </summary> public static class ...

  9. opencc 繁体简体互转 (C++示例)

         繁体字通常采用BIG5编码,简体字通常采用GBK或者GB18030编码,这种情况下,直接使用iconv(linux下有对应的命令,也有对应的C API供编程调用)就行.对于默认采用utf-8 ...

随机推荐

  1. 如何查看sonarqube的版本

    Server Logs & System Info The System Info page is found at Administration > System. It gives ...

  2. facebook api之Access Tokens

    Access Tokens When someone connects with an app using Facebook Login and approves the reqest for per ...

  3. Md5混淆因子

    package cn.springmvc.utils;import org.apache.commons.codec.digest.DigestUtils;import org.apache.comm ...

  4. HDU3377 Plan

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3377 简单路径要求权值最大,那么为了回避括号序列单独插头的情况特判多,考虑使用最小表示法. #incl ...

  5. tkinter拦截关闭事件

    import tkinter as tk from tkinter import messagebox root = tk.Tk() def on_closing(): if messagebox.a ...

  6. TRMM数据在arcgis打开

    基本思路:地图配准 1将投影设置为plate carree(world) ,是在投影坐标系统下的世界中选择,当然为了输入坐标方便,设置属性genral中单位为度,显示为度分秒. 2 首先,要知道打开后 ...

  7. [Android] for ArcFace Demo

    虹软人脸识别引擎Android的Demo演示,可以直接下载使用 下载地址 https://github.com/asdfqwrasdf/ArcFaceDemo 工程如何使用? 1.下载代码: git ...

  8. 学习笔记19—dpabi错误集

    1.回归斜边量的时候千万不要用红色标记的地方,而要用紫色标记的地方

  9. 学习笔记5—Python 将多维数据转为一维数组 (总结)

    <code class="language-python">import operator from functools import reduce a = [[1,2 ...

  10. Windows 操作系统与内核版本号

    Win10查询内部版本(内核版本)的方法:1.按下Win+R组合键启动“运行”窗口,输入“msconfig”并确定2.在“系统配置”窗口中点击“工具”标签,选择“关于Windows”一项后点击“启动” ...