如何同时对多文件内容的替换

10 views
Skip to first unread message

grandpa

unread,
Oct 11, 2008, 2:15:23 PM10/11/08
to Totalcmd中文论坛
手里有48个html文件,每个文件都有一行是描述字符集的如下,

<meta http-equiv="Content-Type" content="text/html;
charset=Shift_JIS">

我想找个简便方法让这48个文件里Shift_JIS,都换成utf-8

我用其他工具会弄这个东西,可是用totalcmd我不会,大家会吗?

helfee

unread,
Oct 11, 2008, 11:00:19 PM10/11/08
to total...@googlegroups.com

用ahk脚本特简单, tc 也不会,,
2008/10/12 grandpa <lxd...@gmail.com>

mars year

unread,
Oct 11, 2008, 11:03:40 PM10/11/08
to total...@googlegroups.com
tc没有替换功能……



2008/10/12 grandpa <lxd...@gmail.com>

grandpa

unread,
Oct 12, 2008, 2:11:49 AM10/12/08
to Totalcmd中文论坛


1)helfee你好,用ahk脚本特简单吗? 我刚发现ahk这东西不久,觉得好像比较有趣,你能利用ahk脚本帮我解决一下这个课题吗?

2)totalcmd的朋友们,如果tc本身不具有替换功能,那么可以用的插件没有吗?

helfee

unread,
Oct 12, 2008, 9:03:59 AM10/12/08
to total...@googlegroups.com

Loop,*.html ;遍历获得此类文件名
{
 FileRead,htm,%A_LoopFileName% ;读取当前文件内容至变量 htm
 StringReplace,htm,htm,charset=Shift_JIS,charset=utf-8 ;替换htm变量中内容
 FileDelete,%A_LoopFileName% ;删除当前文件
 FileAppend,%htm%,%A_LoopFileName% ;写入替换后内容
}

这几句就行了,因该算简单吧~

你先备份了原文件试试吧

注意: 文件编码是ansi吧,如果不是的话还需要加个转换.

2008/10/12 grandpa <lxd...@gmail.com>

wayne

unread,
Oct 12, 2008, 10:03:28 AM10/12/08
to Totalcmd中文论坛
个人认为,什么样的工作就给什么样的软件去处理,没必要非要让一个软件完成所有的任务。

虽然TC很好用,但总不能让TC完成所有的工作吧,呵呵

grandpa

unread,
Oct 13, 2008, 3:09:30 AM10/13/08
to Totalcmd中文论坛
看起来真的蛮有趣,哈哈,这个比较好玩。
谢谢啦

grandpa

unread,
Oct 13, 2008, 3:26:24 AM10/13/08
to Totalcmd中文论坛
wayne好

我用TC时间比较短,以为它替换功能也比较强大呢。
不过搜索功能是蛮牛的。
改名功能也好像蛮牛。
不过我还处于入门阶段。
各位多关照啊。

mars year

unread,
Oct 13, 2008, 9:44:16 AM10/13/08
to total...@googlegroups.com
偶用5年了就不知道它有替换功能



2008/10/13 grandpa <lxd...@gmail.com>
Reply all
Reply to author
Forward
0 new messages