本帖最后由 pcl_test 于 2017-5-29 21:14 编辑
- /*&cls
- @echo off
- rem dir /ad/b/s则可处理子文件夹
- (dir /ad/b^|sort /r)|cscript -nologo -e:jscript "%~f0"
- pause&exit
- */
-
- var fso = new ActiveXObject('Scripting.Filesystemobject');
- while(!WSH.StdIn.AtEndOfStream){
- var line = WSH.StdIn.ReadLine();
- var folder = fso.GetFolder(line);
- var fpath = fso.GetParentFolderName(line);
- var newname = folder.Name.replace(/[\u4E00-\u9FA5]/g,'');
- var newfolder = fpath?fpath+'\\'+newname:newname;
- if(newname&&!fso.FolderExists(newfolder))folder.Name=newname;
- }
- WSH.Echo('Done');
复制代码
|