Page 1 of 1

Basic If Statment BATCH CODING

Posted: 28 Sep 2017 19:54
by maakuasa
Hi! Just a newbie here. I need some help regarding with my project. This is like my 1 time in batch coding and not familiar yet with the codes. My teacher gave me a homework where I need to create a grade system using batch file.

**************************************
The out should be like tis. When you enter the grade it should display the ff:
91-100 = Excellent
81-90 = Very Satisfactory
71-80 = Satisfactory
61-70 = Very Good
51-60 = Good
0-50 = Failed
**************************************
Now I tried the ff code:

If %num% is GRT 90 echo Excellent
If %num% LSS 50 echo Failed

The only problem is I don't know what copde I should use for the rest. As per my teacher there's no command '<=' pr '>=' is batch coding. Any tips how to solve this? There's another activity but it's pretty much the same. I just want to know how to to thru this and I'm pretty ure I will be able to figure the other activity. Thanks in advance!

Re: Basic If Statment BATCH CODING

Posted: 28 Sep 2017 22:01
by Aacini
I am afraid I don't understand what exactly you want from us. Programmers may solve the same problem in different ways, and that depends on the way people thinks. There is no way to teach you to think in a certain way...

I suggest you to try different approachs until you advance in the solution and then make a specific question. The experience you will get via this method is a valuable thing you will not acquire in any other way.

Antonio

Re: Basic If Statment BATCH CODING

Posted: 28 Sep 2017 22:07
by Squashman
Open up the cmd prompt.
Type the following command.

Code: Select all

IF /?

Reading is FUN!

Re: Basic If Statment BATCH CODING

Posted: 29 Sep 2017 06:09
by PaperTronics
I agree totally with Aacini and I suggest you first read the help of the IF command (the way to do that is described by Squashman) and then experiment with the multiple arguments of the IF command.

This method (Trial and Error) may take long, but if you have the time and if you put the right effort into it, you can be a professional Batch Programmer in only a few weeks.




Hope I helped,
PaperTronics