How do I make an application where I will write two or more words in the code set /p ans1=insert text
? [See the code below]
Because if I write two or more words it will automatically crash.
I tried to fix it [from the board forum] Batch: set second word in sentance set /p
@Echo Off
SetLocal EnableDelayedExpansion
Set "sentence="
For /F "Delims==" %%A In ('Set word[ 2^>Nul') Do Set "%%A="
:Loop
Set /P "sentence=Enter a sentence: "
If Not Defined sentence GoTo Loop
Set "i=1"
Set "word[!i!]=%sentence: ="&Set /A. i+=1&Set "word[!i!]=%"
For /L %%A In (1,1,%i%) Do Echo %%word[%%A]%%=!word[%%A]!
Pause
My code:
@echo off
:CMD
set /p ans1=
if %ans1% == goto @unm
:@unm
echo.
for /F "tokens=1,2 delims=#" %%a in.('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
call :ColorText c0 "%text1% %ans1% is not command"
echo.
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
echo.
goto CMD
pause
exit
Comments
Post a Comment