BatchFile " FIND " Statement

Résolu
koalatic Messages postés 384 Statut Membre -  
koalatic Messages postés 384 Statut Membre -
Bonjour,
J'ai commencer à faire ce script:
@Echo Off
:: Configuration
Title Terminal
Color 7
Set time=%time:~0,2%:%time:~3,2%:%time:~6,2%
If Not Exist log.txt Echo %time%#Génération automatique du fichier log > log.txt
If Not Exist config.dat (
  Cls
  Echo.
  Echo 1. Fran#ais
  Echo 2. English
  Echo.
  Set /p lang=
  If "%lang%"=="1" Echo Language: fr > config.dat
  If "%lang%"=="2" Echo Language: en > config.dat
)
If Not Exist usr.scv (
  Echo %time%#Génération automatique du fichier usr.csv >> log.txt
  Goto :Create
)
Goto :Login
:Create
If (
  Find "fr" config.dat (
    Cls
    Echo.
    Echo Quel est votre nom ?
    Echo.
    Set /p user=
    Echo %user% > usr.csv
    Echo. > usr.csv
	Echo Quel mot de passe d'sirez-vous ?
	Pause
  )
)
If (
  Find "en" config.dat (
    Cls
    Echo.
    Echo What's your name ?
    Echo.
    Set /p user=
    Echo %user% > usr.csv
    Echo. > usr.csv
	Echo What's your wished password ?
	Pause
  )
)
Pause
:: /Configuration

Mais lorsque j'entre le chiffre 1 ou 2 pour choisir la langue, l'application se ferme promptement.
Qu'est-ce qui ne vas pas?

Merci de votre aide.



--
Henry Frédéric

2 réponses

  1. dubcek Messages postés 18627 Date d'inscription   Statut Contributeur Dernière intervention   5 660
     
    hello
    peut-être : après les tests de langue, il continue avec goto :Login qui n'existe pas
    0
    1. koalatic Messages postés 384 Statut Membre 21
       
      Non, c'Est pas sa car j'ai mis plus loin :
      :Login 
      Pause  
      Exit

      J'ose pensé que c'est mon FIND qui est mal écrit.
      0
  2. koalatic Messages postés 384 Statut Membre 21
     
    J'ai trouver mon erreur. J'ai refais mon script et voila ce que sa donne.
    @Echo off
    Goto :Config
    
    :Config
    Set time=%time:~0,2%:%time:~3,2%:%time:~6,2%
    Goto :StartUp
    
    :StartUp
    Cls
    If Exist config.dat (
    	Find "Language: Fr_Ca" Config.dat
    	If Not ERRORLEVEL 1 (
    		Cls
    		Echo Francais
    		Pause
    	)
    	If ERRORLEVEL 1 (
    		Cls
    		Echo English
    		Pause
    	)
    )
    If Not Exist config.dat (
    	Set fr=Fran#ais
    	Set en=English
    	Goto :ConfigFile
    )
    Goto :StartUp
    
    :ConfigFile
    Cls
    Echo.
    Echo 1. Fran#ais
    Echo 2. English
    Echo.
    Set /p Lang=
    If "%Lang%"=="1" (
    	Cls
    	Echo.
    	Echo Le %fr% ... 't' d'fini comme langue par d'faut.
    	Echo.
    	Pause
    	Echo Language: Fr_Ca > Config.dat
    	Goto :StartUp
    )
    If "%Lang%"=="2" (
    	Cls
    	Echo.
    	Echo The %en% language has been set as default.
    	Echo.
    	Pause
    	Echo Language: En_Us > Config.dat
    	Goto :StartUp
    )
    Goto :ConfigFile

    0