- rem 另存为 ANSI 编码 bat
- ' & cls & cscript.exe /nologo /e:vbscript "%~f0" %* & pause & exit /b
-
- p = "." '当前路径。可以指定其它路径,比如 d:\test\
-
- Set oWshShell = CreateObject("WScript.Shell")
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- p = oFSO.GetAbsolutePathName(p)
- oWshShell.CurrentDirectory = p
- For Each i In oFSO.GetFolder(p).Files
- s = oFSO.GetFileName(i)
- t = ""
- For j = 1 To Len(s)
- If CLng("&H" & Hex(Asc(Mid(s, j, 1)))) < 127 Then t = t & Mid(s, j, 1)
- Next
- If Not oFSO.FileExists(t) Then oFSO.MoveFile s, t
- Next
- wsh.Echo "ok"
复制代码 只保留ascii编码的字符
只处理当前文件夹下的文件
如果同名文件已存在则跳过 |