Bonjour à tous.
J'ai un script .bat qui permet de lancer plusieurs tâches (lancement d'autres .bat pour installation de logiciels et autres...) [merci à ericlm128]
Pour le moment, le script et le dossier complet doivent être placés à la racine de C:\ pour fonctionner correctement.
Je souhaiterai effectuer une modification.
Je voudrais que le script puisse fonctionner même si le dossier n'est pas placé à la racine de C:\
Pour cela, je me suis dit qu'il fallait que je définisse une variable path.
Script "Start.bat"
Code BATCH : Sélectionner tout - Visualiser dans une fenêtre à part set path=%path%;C:\Users\%username%\desktop\PrepaPC
Code BATCH : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 @echo OFF setlocal ENABLEDELAYEDEXPANSION cls color E REM Initialize for /L %%I in (1,1,2) do set ITEM%%I=[ ] :Boucle cls echo ############################## echo #~~ CONFIGURATION DE POSTE ~~# echo ############################## echo. echo Choisissez la marque de votre PC : echo. echo %ITEM1% 01. Autres PC echo %ITEM2% 02. Lenovo echo. echo Taper "Q" pour Quitter echo Taper "1" ou "2" pour faire votre choix et appuyer sur "ENTER" echo Taper "R" pour valider votre choix et appuyer sur "ENTER" echo Taper "X" pour afficher le fichier de note de versions set WhichItem= set /P WhichItem=Faites votre choix et appuyer sur "ENTER" : if not defined WhichItem goto Boucle if /I "%WhichItem%"=="Q" goto exit if /I "%WhichItem%"=="R" goto RunOptions if /I "%WhichItem%"=="X" goto item3 set /A WhichItem=%WhichItem% for /L %%I in (1,1,2) do if "%%I"=="%WhichItem%" ( if "!Item%WhichItem%!"=="[X]" ( set Item%WhichItem%=[ ] ) else ( set Item%WhichItem%=[X] ) ) goto Boucle :RunOptions for /L %%I in (1,1,2) do if "!Item%%I!"=="[X]" call :Item%%I pause goto :EOF :item1 REM Autres PC call C:\PrepaPC\ConfigPC\Menu\Batch#1\#StartPC#.bat goto :EOF :item2 REM Lenovo call C:\PrepaPC\ConfigPC\Menu\Batch#1\#StartLenovo#.bat goto :EOF :item3 REM Note de versions start notepad C:\PrepaPC\Version.txt goto :EOF :exit exit
Cependant, j'obtiens une erreur une fois ma sélection faite.
La fenêtre CMD m'affiche une erreur :
Je ne vois pas d'où peut venir mon erreur.
Merci d'avance pour votre aide.
Partager