batch file - How to read text from command prompt using a .bat -


i trying windows batch files , programming in general, messed around example found online , made batch file creates batch file (for sake of learning)

but want enable typing command prompt, have crude solution make batch file, create batch file , start file using orignal .bat (don't worry, code below, make sense.)

basically if type 1, want in batch, know need first if, it's trying text entered in command line i'm struggling with.... great!

@echo off   if exist commandtest.bat (      echo file exists...   pause ) else (     echo commandtest.bat not exist. creating file...    timeout /t 3 /nobreak>nul     echo please wait while file loads...          echo @echo off >commandtest.bat          echo color 0a >>commandtest.bat          echo echo line number 1 >>commandtest.bat          echo timeout /t 3 /nobreak>nul >>commandtest.bat          echo echo line number 2 >>commandtest.bat          echo timeout /t 3 /nobreak>nul >>commandtest.bat          echo echo line number 3 >>commandtest.bat          echo timeout /t 3 /nobreak>nul >>commandtest.bat          echo echo line number 4 >>commandtest.bat          echo timeout /t 3 /nobreak>nul >>commandtest.bat     timeout /t 2 /nobreak>nul  start commandtest.bat  timeout /t 5 /nobreak>nul  ) 

i trying redesign user interactive...

according comment, choice right choice you:

@echo off echo 1 - echo 2 - else echo 3 - nothing choice /c 123 /m "take choice " if %errorlevel% == 1 echo let's if %errorlevel% == 2 goto :other if %errorlevel% == 3 echo let's nothing pause goto :eof  :other  echo let's else echo else ... pause 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -