1.

Solve : Need batch to ask questions only on 1st run?

Answer» 2 ex. how this can be done

1.
file.bat

Code: [Select]@echo off
setlocal enabledelayedexpansion

for /F "tokens=1,2 delims=;" %%B in ('type file.bat ^|findstr /B /C:"///ANS"') do (
set /a num+=1
echo.!num! ANS is %%c
)

set /p ans1=
set /p ans2=
set /p ans3=

echo.>>file.bat
echo.///ANS1;%ans1% >>file.bat
echo.///ANS2;%ans2% >>file.bat
echo.///ANS3;%ans3% >>file.bat

pause
exit
so if you set ans1 to aaa ans2 to BBB and ans3 to ccc it will produce on next start
Code: [Select]1 ANS is aaa
2 ANS is bbb
3 ANS is cccand you can do whatever you WANT with this


2.
file.bat
Code: [Select]@echo off

if exist file.txt goto DONE
set /p ans1=
set /p ans2=
set /p ans3=

echo.>>file.txt

:DONE
echo.SOME TEXT
pause
exit
if all ANSWERS are asked it makes file.txt and at startup checks for this file so it know if you asked or no


Discussion

No Comment Found