文件名简体转繁体bat
@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的更多相关文章
- Python 汉字简体和繁体的相互转换
其实利用python实现汉字的简体和繁体相互转早有人做过,并发布到github上了,地址:https://github.com/skydark/nstools/tree/master/zhtools ...
- bing 输入法,切换简体、繁体快捷键与myeclipse 格式化代码冲突。。
bing 输入法,切换简体.繁体快捷键与myeclipse 格式化代码冲突...蛋碎 myeclipse 代码格式化快捷键是:ctrl+shift+F,bing输入法简体.繁体切换也是,于是蛋疼的事情 ...
- .net 简体转换繁体实例,繁体转换简体 Encode.dll、下载
在项目中先引用Encode.dll 下面是下载地址: Encode.dll ChineseConverter.dll 1.html页面代码 <%@ Page Language="C# ...
- 简体和繁体加起来有六七万个汉字,所以Unicode只能排除一些几乎不用的汉字,Unicode编码的熟悉与研究过程(内附全部汉字编码列表)
我有一个问题是:是不是会有个别汉字无法在Unicode下表示,这种情况下就不能完全显示了? 各种编码查询表:http://bm.kdd.cc/ ---------------------------- ...
- Scrapy中将item字段转为简体or繁体
1. 安装hanziconv安装一个简繁体转换的包: pip install hanziconv 2. 自定义一个itempiples找到项目中的pipelines.py文件 添加自定义的pipeli ...
- Windows 8.1 with Update MSDN 简体/英文/繁体
PS:请不要使用离线下载,以免镜像损坏! 1.CN: 文件名:cn_windows_8.1_enterprise_with_update_x64_dvd_4048578.isoSHA1:2D9BFE9 ...
- [函數] Firemonkey 各平台 "简体" / "繁体" 判断
目前的 Delphi 10 Seattle 的 TLang 尚不支持取得简体及繁体的语系字符,在能取得正确的语系字符后(整理中),才能使用下列函数判断: function ChineseLang(co ...
- c#简体繁体转换
方法一已经亲测,使用正常,方法二貌似不能用. 方法一 /// <summary> /// 中文字符工具类 /// </summary> public static class ...
- opencc 繁体简体互转 (C++示例)
繁体字通常采用BIG5编码,简体字通常采用GBK或者GB18030编码,这种情况下,直接使用iconv(linux下有对应的命令,也有对应的C API供编程调用)就行.对于默认采用utf-8 ...
随机推荐
- 使用JAX-WS开发WebService
Axis2和CXF是目前流行的Webservice框架,这两个框架都属于重量级框架.相对而言,JAX-WS RI是一个轻量级的框架.开发WebService只需要很简单的几个步骤:写接口和实现-> ...
- (zhuan) 深度学习全网最全学习资料汇总之模型介绍篇
This blog from : http://weibo.com/ttarticle/p/show?id=2309351000224077630868614681&u=5070353058& ...
- SpringBatch是什么?
https://segmentfault.com/a/1190000016278038 <dependency> <groupId>org.springframework.bo ...
- Visual studio 离线安装
VS2017在下载好安装程序安装的时候,会根据你选择的功能模块来下载所需要的安装程序,而这些安装程序的下载位置并不会让你选择,而是直接放在 C:\ProgramData\Microsoft\Visua ...
- 51nod P1305 Pairwise Sum and Divide ——思路题
久しぶり! 发现的一道有意思的题,想了半天都没有找到规律,结果竟然是思路题..(在大佬题解的帮助下) 原题戳>>https://www.51nod.com/onlineJudge/ques ...
- printf和cout的区别详述
https://blog.csdn.net/ysayk/article/details/50959909
- sql注入解析
sql注入解析 sql注入解析(一)基本语法 sql注入解析(二)执行注入 sql注入解析(三)数据库类型 sql注入解析(四)避开过滤
- video组件的使用
<video width="100%" height="100%" :src="downloadUrl" controls=" ...
- 【Ruby】【遇到的问题】
1 Error fetching https://gems.ruby-china.org/: certificate verify failed (https://gems.ruby-china.or ...
- 【Oracle】【问题】
1. java.sql.SQLException: 对只转发结果集的无效操作: last 参考:https://www.cnblogs.com/gaoyuchuanIT/articles/411888 ...