1

I'm trying to make my batch script to check if a file (config.ini) exists. if it does, then show the defined vars if not, i want to set the vars and write them to a file.

this is my code:

@echo off
IF EXIST config.ini (
    for /f "delims=" %%x in (config.ini) do (set "%%x")
    ) ELSE (
    echo enter v1
    set /p var1=""
    echo enter v2
    set /p var2=""
    @echo var1=%var1%> config.ini
    @echo var2=%var2%>> config.ini
)
echo %var1% 
echo %var2%
pause

however, when I input the values for the vars, the output that I get in the config.ini is only partial:

var1= 
var2=

please help me to fix this.

Druz
  • 85
  • 1
  • 11

0 Answers0