N
N
newaitix2022-04-13 13:55:38
cmd/bat
newaitix, 2022-04-13 13:55:38

How to build the correct if condition?

Hello. Please help me improve the script. The idea is to take a line from the file and substitute its phrase "Enter ver:"
For example, if in the file 11111 it turned out to be Enter ver: 11111
And if the user presses enter, then the value 11111 was written to the %var% variable. And if the user enters that sometimes by hand and presses enter, then what he entered by hand was written to the% var% variable.

@echo off
:next
Set file=D:\version
For /F "usebackq tokens=* delims=" %%i In ("%file%") Do Set vap=%%i
set /p var="Enter ver: %vap%"
if "%var%" neq "%var:,=%" goto next

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