User input not recording properly.
Posted: 20 Dec 2018 09:54
Wrote batch file that offers a menu of choices in which the user can select multiple answers by entering numbers that corresponds with the answer separated by a space. I have to open a CMD first then run the script from there. When I do the first time I run it, the answers are not created. Run the script a second time from the same command window and it records the answers made the first time. Run a third and it records the answers from the second time and so on. If I just run the script without opening a command window it doesn't record anything. It should write users answers to a text file.
Code: Select all
@Echo off
CLS
SET/P MonDef=Does Monitor have any defects? (y or n): %=%
IF /i %MonDef%==n (
Set text=Does Monitor have any defects? There are no cracks or other physical defects in monitor.
Echo %text%
CALL %USERPROFILE%\Desktop\WriteText.bat
) Else If /i %MonDef%==y (
Echo The display is cracked ---- 1
Echo The display is dim -------- 2
Echo The display is blurry ----- 3
Echo The display is discolored - 4
SET /p DisplayDef=Please type in the numbers of that corresponds with the display issues separated by a space: %=%
FOR %%i IN (%DisplayDef%) DO (
IF %%i==1 (
Echo Test 1
::Pause.
SET text=Monitor is cracked.
CALL %USERPROFILE%\Desktop\WriteText.bat
) ELSE IF %%i==2 (
Echo Test 2
SET text=Monitor is dim.
CALL %USERPROFILE%\Desktop\WriteText.bat
) ELSE IF %%i==3 (
Echo Test 3
SET text=Monitor is blurry
CALL %USERPROFILE%\Desktop\WriteText.bat
) ELSE IF %%i==4 (
Echo Test 4
SET text=Monitor is discolored.
CALL %USERPROFILE%\Desktop\WriteText.bat
)
)
)
PAUSE