在一个文本文件,批处理文件替换字符 [英] Replacing characters in a text file with a batch file

查看:166
本文介绍了在一个文本文件,批处理文件替换字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用一个批处理文件来替换在文本文件中的某些字符?

Is there a way to replace some characters in a text file with a batch file?

我没有发现任何命令来做到这一点。

I didn't find any command to do that.

推荐答案

简单的回答是不,不是基本的Windows实用程序

The quick answer is "No, not with basic windows utilities"

但正如其他的答案表明,有很多UNIX端口在那里,做你想做的。就拿alook在的GnuWin32包的。

But as the other answers suggested, there are lots of unix ports out there that do what you want. Take alook at gnuwin32 packages.

编辑:

好吧,我修改我的严格的否。有可能是做这件事,这取决于你的任务,你的操作系统的复杂性的一种方式。当使用Windows 2000及以上,CMD提供命令的扩展,你可以使用。

Okay, I revise my strict "No". There might be a way of doing it, depending on the complexity of your task and your OS. When using windows 2000 and above, cmd provides command extensions that you can use.

其基本思想是使用FOR循环要经过一个输入文件的每一行,然后使用由SET命令提供的字符串替换来替换你的角色。

The basic idea is to use a FOR loop to go through each line of an input file and then to use string substitution provided by the SET command to replace your characters.

我手头没有解决方案,但这个rel=\"nofollow\"> 的非常酷的网站你可以自己尝试一下,使用infromation从这里 FOR循环语法和的这里的字符串替换。

I have no solution at hand but you might try on your own, using infromation from this quite cool site. Look here for the FOR loop syntax and here for the string substitution.

这篇关于在一个文本文件,批处理文件替换字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆