P
P
Pavel Lapin2017-07-26 23:14:30
Automation
Pavel Lapin, 2017-07-26 23:14:30

How to replace paths in all project files?

A large project, a lot of *.c, *.lib, *.js, *.html files, etc., the paths that need to be replaced are written inside (the part that is up to the project folder itself). Now in each file I change all the paths in sublime at once, but there are quite a few files. How to do it faster through the Windows command line?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aynur_safin, 2017-07-27
@aynur_safin

Replace Text
www.ecobyte.com/replacetext
or batch file:

@echo off
Setlocal EnableExtensions

Set infile=%1
Set find=что_меняем
Set replace=на_что_меняем

SetLocal EnableDelayedExpansion

for /f "usebackq delims= eol=" %%n in (!infile!) do (
set LINE=%%n
set TMPR=!LINE:%find%=%replace%!
Echo !TMPR!>>!infile!-TMP.TXT
)

copy %infile% %infile%.bak
move %infile%-TMP.TXT %infile%

D
Dimonchik, 2017-07-27
@dimonchik2013

so why in each file - change at once in all
for example textpad can do this

D
Dmitry, 2022-02-25
@good_br

And how to make sure that the bak extension is not put at the end of the file?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question