¿Cómo se puede reemplazar texto en un archivo usando el entorno de línea de comandos de Windows?

I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "Release") with another(ex. "Debug"). What is the simplest way to do that? Any built in functions?

preguntado el 30 de enero de 12 a las 19:01

2 Respuestas

There is no truly native solution but there are set and sed like utilities for this situation.

See here for a list

Cygwin, UnxUtils, GnuWin32, AT&T Research's UWIN system, MSYS from MinGw 

Related question on Stack Overflow where I got the list from

contestado el 23 de mayo de 17 a las 15:05

In a prior life I was a PC lab tech. There were a number of command-line utilities that would perform that function, and the greatest them likely was any of the Perl clients.

Given that you've posted this question on StackOverflow, I'm going to make the assumption you're comfortable with at least some mild script-level programming.

My Perl life is far behind me now, but if you download one of their clients and ping a web search such as "string-token-replace perl example" I'm confident you'll not only find exactly what you're looking for but discover a tool set with more flexibility than you may believe possible.

Respondido el 30 de enero de 12 a las 23:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.