BatchFile " FIND " Statement

Résolu/Fermé
koalatic Messages postés 327 Date d'inscription lundi 9 juillet 2007 Statut Membre Dernière intervention 11 août 2015 - 18 févr. 2013 à 11:23
koalatic Messages postés 327 Date d'inscription lundi 9 juillet 2007 Statut Membre Dernière intervention 11 août 2015 - 18 févr. 2013 à 22:21
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.



2 réponses

dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
18 févr. 2013 à 16:33
hello
peut-être : après les tests de langue, il continue avec goto :Login qui n'existe pas
0
koalatic Messages postés 327 Date d'inscription lundi 9 juillet 2007 Statut Membre Dernière intervention 11 août 2015 21
Modifié par koalatic le 18/02/2013 à 18:56
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
koalatic Messages postés 327 Date d'inscription lundi 9 juillet 2007 Statut Membre Dernière intervention 11 août 2015 21
18 févr. 2013 à 22: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