How can you find and replace text in a file using the Windows command-line environment? -


i writing batch file script using windows command-line environment , want change each occurrence of text in file (ex. "foo") (ex. "bar"). simplest way that? built in functions?

if on windows version supports .net 2.0, replace shell. powershell gives full power of .net command line. there many commandlets built in well. example below solve question. i'm using full names of commands, there shorter aliases, gives google for.

(get-content test.txt) | foreach-object { $_ -replace "foo", "bar" } | set-content test2.txt 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -