- //&cls&dir /a-d/b *.doc|cscript -nologo -e:jscript "%~f0"&pause&exit
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- while(!WSH.StdIn.AtEndOfStream){
- var line = WSH.StdIn.ReadLine();
- var file = fso.GetFile(line);
- var name = fso.GetBaseName(line).replace(/\d+/g, '').replace(/^\s+|\s+$/, '');
- var ext = '.'+fso.GetExtensionName(line);
- if(name&&!fso.FileExists(file.ParentFolder+'\\'+name+ext))file.Name=name+ext;
- }
复制代码
|