Search found 4 matches

by Fireball
03 Nov 2013 21:14
Forum: DOS Batch Forum
Topic: IF Statement not Working
Replies: 6
Views: 6447

Re: IF Statement not Working

I GOT IT!!! I figured out that to make "~0,1" work, I just had to put it in quotation marks like so: if "!fieldtype%y%:~0,1!"=="1" ( set /p enter%y%=Enter your name: if "!enter%y%! "=="!field%i%!" goto UNLOCK goto INTRUDER ) Thanks you guys, I wouldn...
by Fireball
03 Nov 2013 20:29
Forum: DOS Batch Forum
Topic: IF Statement not Working
Replies: 6
Views: 6447

Re: IF Statement not Working

Yeah, it returns "1 ". How would I get rid of this space. I've tried !fieldtype%y%:~0,1! but it says:
1!==1 was unexpected at this time.
Does this help?
by Fireball
03 Nov 2013 17:49
Forum: DOS Batch Forum
Topic: IF Statement not Working
Replies: 6
Views: 6447

Re: IF Statement not Working

What's so different? (By the way, it works when I set fieldtype!y! to 1, making the whole thing make even less sense. Even more confusing, I tried echoing !fieldtype%y%! and it showed 1, but it still blew over the if statement!) echo !fieldtype%y%! pause if !fieldtype%y%!==1 ( echo Y: %y% echo I: %i...
by Fireball
03 Nov 2013 14:25
Forum: DOS Batch Forum
Topic: IF Statement not Working
Replies: 6
Views: 6447

IF Statement not Working

This is my (probably too complex and can be simplified a thousand times) code: :DECLARE_UNLOCK cls set i=0 set y=0 for /F "tokens=*" %%A in (%USERPROFILE%\fields.txt) do ( SET /A i+=1 set field!i!=%%A ) for /F "tokens=*" %%A in (%USERPROFILE%\fieldtype.txt) do ( SET /A y+=1 set f...