从命令提示符 Windows 7 将文本插入到文件中
我想在 Windows 7 中从命令提示符编辑一个文本文件。我有一个文本文件,我想在该文件中搜索特定的字符串。然后我需要在字符串中附加一些字符串。 然后,我需要保存或覆盖它。
I want to edit a text file from command prompt in Windows 7. I have a text file, i want to search for particular String in that file. then I need to append some more string to string.
Then, I need to save or over write it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
批处理命令语言不太适合此类任务。使用其他脚本语言会更好,例如 js 或 vbs 或(如果您的目标是 Windows 7)powershell。如果您确实想使用批处理命令语言来执行此操作,您可以使用
for /f
拼凑一些东西来从输入文件中读取内容,并使用echo
写入到输出文件。请注意,这不会很有趣。The batch command language is not well-suited to this sort of task. You would be much better served using some other scripting language, like js or vbs or (if you are targeting Windows 7) powershell. If you really want to do it in the batch command language, you can sort of cobble something together with
for /f
to read from the input file andecho
to write to the output file. Mind you, it won't be fun.