N
N
newaitix2022-04-05 21:08:11
cmd/bat
newaitix, 2022-04-05 21:08:11

Why does the script not work when there are characters in the string?

There is a script. The goal is to substitute the version number in quotation marks. To do this, I look for the word version and replace the entire line with that word with the desired one.

@echo off
set verfile=D:\sw.txt
set tmpfile=D:\sw.tmp
set seek=version
if exist %tmpfile% del /q %tmpfile%
for /f "delims=" %%a in (%verfile%) do (
  (echo %%a)|>nul find /i "%seek%="&&((echo var %seek%='0';)>>%tmpfile%)
  (echo %%a)|>nul find /i "%seek%="||(echo %%a)>>%tmpfile%
)
copy /y %tmpfile% %verfile% >nul
del /f /q %tmpfile% >nul

For some reason it does not replace the string.
"version":"5.5.3.5",replaces
Why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question