正则方便- //&cls&@ dir /s /b "*(*)*.mp4"| CScript -NoLogo -E:JScript "%~0" &pause&exit
- var fso=new ActiveXObject("Scripting.FileSystemObject");
- var file=null;
- var newName=null;
- while (!WScript.StdIn.AtEndOfStream){
- try{
- file=fso.GetFile(WScript.StdIn.ReadLine());
- newName=file.Name.replace(/\(.*?\)/g,"");
- WSH.Echo(file.Path+"\n"+newName);
- file.Name=newName;
- WSH.Echo("success!");
- }catch(e){
- WSH.Echo("failed:"+e.message);
- } finally {
- WSH.Echo("--------------------------------");
- }
- }
复制代码
|