Batch plus petit plus garnd

Résolu
Bonjour,
J'ai fait un bat tout a fait inutile
@echo off

:restart

set n= %random%%%1000

:start

set /p u=Nombre (0,999) ?

If %u% == %n% goto :win

If %u% < %n% goto :p

If %u% > %n% goto :g

:p
echo Plus grand
.
goto :start

:g
echo Plus petit.

goto :start

:win

echo bravo !!

set /p r= recommencer (o/n) ?

if %r% == o goto :restart

Mais > et < ne marche pas comment faire pour "voir" si deux variable sont differente ?
Configuration: Windows 7
Firefox 3.5.5

7 réponses

  1. Contributeur
    ello
    dans help if
    EQU - égal à
    NEQ - différent de
    LSS - inférieur à
    LEQ - inférieur ou égal à
    GTR - supérieur à
    GEQ - supérieur ou égal à
    1. Ca ne marche pas : @echo off

      :restart

      set n= %random%%%1000

      :start

      set /p u=Nombre (0,999) ?

      If %u% == %n% goto :win

      If %u% GTR %n% goto :p

      If %u% LSS %n% goto :g

      :p
      echo Plus grand
      .
      goto :start

      :g
      echo Plus petit.

      goto :start

      :win

      echo bravo !!

      set /p r= recommencer (o/n) ?

      if %r% == o goto :restart

      Je lais surement mal placer ....
      1. Contributeur
        n'y aurait-il pas une erreur là
        C:> set n= %random%%%1000

        C:> echo %n%
        14383%%1000

        essaye avec
        set /a n=%random%%1000
        1. Oui je l'ai corriger ...

          If %u% GTR %n% goto :p

          If %u% LSS %n% goto :g

          sont inverser aussi ... ce qui donne :

          @echo off

          :restart

          set /a z=-1

          set /a n= %random%%%1000

          :start

          set /a z=%z% + 1

          set /p u=Nombre (0,999) ?

          If %u% == %n% goto :win

          If %u% GTR %n% goto :p

          If %u% LSS %n% goto :g

          :p
          echo Plus petit

          goto :start

          :g
          echo Plus grand
          goto :start

          :win

          echo bravo !! en %z% coups !!

          set /p r= recommencer (o/n) ?

          if %r% == o goto :restart

          avec un petit compteur !
          1. Contributeur
            set /a n=%random%%1000
            et non pas:
            set /a n= %random%%%1000