回复 6# dzwind
删除文件末尾连续的空白字符(包括空格/制表符/换行符)- @set @v=1 /*
- @echo off
- if "%~1" neq "" for /f "delims=" %%F in (' dir /b/s/a-d "%~1\*.txt" ') do (
- cscript /e:jscript "%~f0" "%%~F" "%%~dpnF.new%%~xF"
- move /y "%%~dpnF.new%%~xF" "%%~F">nul
- )
- pause&exit/b
- */
- v=WSH.arguments, as=WSH.createobject('adodb.stream');
- as.mode=3, as.type=2, as.charset='437', as.open, as.loadfromfile(v(0));
- s=as.readtext(), as.close, s=s.replace(/\s*$/, '');
- as.open, as.writetext(s), as.savetofile(v(1),2), as.close, WSH.quit();
复制代码
|