本帖最后由 ivor 于 2016-2-20 20:23 编辑
- @echo off&setlocal enabledelayedexpansion
- for /r %%i in (*.bat) do (
- set kill=0
- for /f %%a in ('type exclude.txt') do (
- if [%%~nxa] equ [%%~nxi] (set kill=1)
- )
- if !kill! equ 0 (rename "%%i" "%%~ni.txt")
- )
- pause
复制代码
- # python 3.5.1
- # coding:utf-8
- # by:ivor bathome.net
- # 当前目录所有Bat文件更换后缀,例外字典ignoreFile
-
- import re, os
-
- ignoreFile = {"1.bat", "2.bat"}
- for file in os.listdir("."):
- if file not in ignoreFile:
- if file.endswith(".bat"):
- os.rename(file, file.split(".")[0] + ".txt")
复制代码
|