Solved How do I do this, please help?

September 14, 2017 at 17:46:16
Specs: Windows 10
How can I make it so that everytime that I type a name that isn't James, it prints out bad?


@echo off
set /p name=What is your name?:
if %name%==James (
goto :A
else
echo Bad
)
pause
:A
echo Good
pause


See More: How do I do this, please help?

Reply ↓  Report •

#1
September 14, 2017 at 22:34:18
✔ Best Answer
NOT TESTED:

replace

else

with

) else (

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

#2
September 14, 2017 at 23:03:43
There is no such command as else with reversed brackets.

Reply ↓  Report •

#3
September 15, 2017 at 01:12:22
Dunno about "reversed brackets" as #2 famously put it but here's an example of ELSE usage:

:: 
:: skip2 Tue 09-06-2009  5:53:18.93

@echo off > newfile & setLocal EnableDelayedExpansion

for /f "skip=2 tokens=1* delims=[]" %%a in ('find /v /n "" ^< myfile') do (
if "%%b" neq "" (
echo %%b >> newfile
) else (
echo. >> newfile
)
)

goto :eof

::===========================================

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

Related Solutions

#4
September 15, 2017 at 16:06:24
Thanks guys!! I got it to work.

Reply ↓  Report •

Ask Question