IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Scripts/Batch Discussion :

Sélection multiples dans .bat [Batch]


Sujet :

Scripts/Batch

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Décembre 2018
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Décembre 2018
    Messages : 49
    Par défaut Sélection multiples dans .bat
    Bonjour à toutes et à tous.
    Je viens vers vous aujourd'hui pour une question concernant la possibilité de faire des choix multiples dans un batch.
    J'ai un script .bat qui installe des logiciels à la suite en silent install.
    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
    @echo off
    color b
    echo ~~~~INSTALLATION LOGICIELS~~~~
    echo ~## 7ZIP ##~
    	msiexec /i "C:\ConfigPC\Soft\7Zip\7z1900.msi" /quiet
    echo ~## ACROBAT READER DC ##~
    	msiexec /i "C:\ConfigPC\Soft\AcrobatDC\AcroRead.msi" /quiet
    echo ~## CCLEANER ##~
    	start /w C:\ConfigPC\Soft\Ccleaner\Ccleaner565.exe /S
    		copy "C:\ConfigPC\Soft\Ccleaner\ccleaner.ini" "C:\Program Files\CCleaner"
    echo ~## DOTNET3.5 ##~
    	dism /online /enable-feature /featurename:NetFX3 /All /Source:C:\ConfigPC\Soft\DotNet /LimitAccess
    echo ~## GOOGLE CHROME ##~
    	msiexec /i "C:\ConfigPC\Soft\Chrome\Chrome81.msi" /qn
    echo ~## MOZILLA FIREFOX ##~
    	start /w C:\ConfigPC\Soft\Firefox\Firefox75.exe /s
    echo ~## JAVA ##~
    	start /w C:\ConfigPC\Soft\Java\Java8u251.exe /s
    echo ~## NOTEPAD++ ##~
    	start /w C:\ConfigPC\Soft\NotePad++\NotePad++785.exe /S
    echo ~## SKYPE ##~
    	start /w C:\ConfigPC\Soft\Skype\Skype_858098.exe /VERYSILENT /SP- /NOCANCEL /NORESTART /SUPPRESSMSGBOXES /NOLAUNCH
    		taskkill /f /IM Skype.exe
    echo ~## VLC ##~
    	start /w C:\ConfigPC\Soft\VLC\VLC308.exe /S

    Je souhaite que l'on puisse, soit installer la totalité des softs, soit certains via une sélection.
    J'ai trouvé un exemple de .bat que j'ai modifié pour qu'il corresponde aux logiciels.
    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
    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
     
    REM Initialize
    FOR /L %%I IN (1,1,25) DO SET ITEM%%I=[ ]
     
    :Boucle
    CALL :MenuSoftware
    CALL :Valeur
     
    IF /I "%WhichItem%"=="Q" GOTO :EOF
    IF /I "%WhichItem%"=="R" GOTO RunOptions
     
    FOR /L %%I IN (1,1,25) DO IF "%%I"=="%WhichItem%" (
    	IF "!Item%WhichItem%!"=="[X]" (
    		SET Item%WhichItem%=[ ]
    	) ELSE (
    		SET Item%WhichItem%=[X]
    	)
    )
    GOTO Boucle
     
    :RunOptions
    REM Remove the ECHO from the next line to actually run the files.
    FOR /L %%I IN (1,1,25) DO IF "!Item%%I!"=="[X]" type %%I.BAT >> TEST_Menu1.bat
    call C:\TEST_Menu1.bat && exit
    GOTO :EOF
     
    :MenuSoftware
    CLS
    ECHO Choisissez les logiciels que vous souhaitez installer :
    ECHO.
    ECHO %ITEM1% 01. Tous les logiciels
    ECHO %ITEM2% 02. 7Zip
    ECHO %ITEM3% 03. Acrobat Reader DC
    ECHO %ITEM4% 04. Ccleaner
    ECHO %ITEM5% 05. Google Chrome
    ECHO %ITEM6% 06. DotNet_3.5
    ECHO %ITEM7% 07. Edge Chromium
    ECHO %ITEM8% 08. Mozilla Firefox
    ECHO %ITEM9% 09. Java
    ECHO %ITEM10% 10. Lenovo System Update
    ECHO %ITEM11% 11. NotePad++
    ECHO %ITEM12% 12. Skype
    ECHO %ITEM13% 13. VLC
    ECHO.
    ECHO Taper Q pour Quitter
    ECHO Taper R pour lancer l'installation
    GOTO :EOF
     
    :Valeur
    ECHO.
    REM The next line has a single trailing space
    SET /P WhichItem=Faites votre choix et appuyer sur ENTER : 
    GOTO :EOF

    Cependant, je ne vois pas comment faire pour que l'installation se lance avec les bons logiciels sélectionnés.
    Dois-je modifier le script initial (installation logiciels) ?
    Dois-je créer des scripts différents pour l'installation de chaque logiciel ?
    J'ai vraiment essayé de trouver par mes propres moyens mais là je sèche complétement.
    J'espère avoir assez clair...
    Merci d'avance pour votre aide.

  2. #2
    Membre confirmé
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Décembre 2018
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Décembre 2018
    Messages : 49
    Par défaut
    J'ai apporté des modifications sur le premier batch.
    Sur cette version j'utilise un menu mais celui ci ne me donne que la possibilité d'installer la totalité des applications etc...
    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    @echo off
    color E
    cd /d C:\ConfigPC ||exit /b 1
    echo /!\ CONFIGURATION PC /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~
     
    :menu1
    echo ~~~~CONFIGURATION PC~~~~
    echo ~~~~~~~~~MENU~~~~~~~~~~~
    echo.
    echo 1-Applications
    echo 2-Explorer.exe
    echo 3-Fonctionnalites
    echo 9-Quitter
    echo.
    set /p reponse="Quel programme voulez-vous executer ?"
     
    If /i "%reponse%"=="1" goto :applications
    If /i "%reponse%"=="2" goto :Explorer
    If /i "%reponse%"=="3" goto :fonctionnalites
    If /i "%reponse%"=="9" goto :fin
     
    :applications
    cls
    @echo off
    color b
    echo ~~~~~CONFIGURATION PC LENOVO~~~~~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    echo ~## SUPPRESSION APPS WINDOWS 10 ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\01_REMOVEAPPS.ps1
    echo ~## 7ZIP ##~
    echo ~~~~~~~~~~~~
    	msiexec /i "C:\ConfigPC\Soft\7Zip\7z1900.msi" /quiet
    echo ~## ACROBAT READER DC ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~
    	msiexec /i "C:\ConfigPC\Soft\AcrobatDC\AcroRead.msi" /quiet
    echo ~## CCLEANER ##~
    echo ~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Ccleaner\Ccleaner565.exe /S
    		copy "C:\ConfigPC\Soft\Ccleaner\ccleaner.ini" "C:\Program Files\CCleaner"
    echo ~## DOTNET3.5 ##~
    echo ~~~~~~~~~~~~~~~~~
    	dism /online /enable-feature /featurename:NetFX3 /All /Source:C:\ConfigPC\Soft\DotNet /LimitAccess
    echo ~## Edge Chromium ##~
    echo ~~~~~~~~~~~~~~~~~~~~~
    	msiexec /i "C:\ConfigPC\Soft\Edge_Chromium\MicrosoftEdgeEnterpriseX64.msi" /quiet /norestart
    echo ~## GOOGLE CHROME ##~
    echo ~~~~~~~~~~~~~~~~~~~~~
    	msiexec /i "C:\ConfigPC\Soft\Chrome\Chrome81.msi" /qn
    echo ~## MOZILLA FIREFOX ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Firefox\Firefox75.exe /s
    echo ~## JAVA ##~
    echo ~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Java\Java8u251.exe /s
    echo ~## LENOVO-SYSTEM-UPDATE ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Lenovo\LSU50795.exe /verysilent /norestart
    echo ~## NOTEPAD++ ##~
    echo ~~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\NotePad++\NotePad++785.exe /S
    echo ~## SKYPE ##~
    echo ~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Skype\Skype_858098.exe /VERYSILENT /SP- /NOCANCEL /NORESTART /SUPPRESSMSGBOXES /NOLAUNCH
    		taskkill /f /IM Skype.exe
    echo ~## VLC ##~
    echo ~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\VLC\VLC308.exe /S
    echo ~## WINRAR ##~
    echo ~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\WinRAR\WinRAR_590.exe /S
    		TIMEOUT /T 2
    			START WinRAR
    				taskkill /F /IM WinRAR.exe
    					TIMEOUT /T 2
    						COPY "C:\ConfigPC\Soft\WinRAR\REG01\rarreg.key" "C:\Users\%username%\AppData\Roaming\WinRAR\"
    							MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes"
    								MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare"
    									MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare\Toolbar"
    										COPY "C:\ConfigPC\Soft\WinRAR\AlienWare\Toolbar" "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare\Toolbar"
    											COPY "C:\ConfigPC\Soft\WinRAR\AlienWare" "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare"
    												COPY "C:\ConfigPC\Soft\WinRAR\Rar.exe" "C:\Windows\System32\"
    echo ~## OFFICE 2K19 ##~
    echo ~~~~~~~~~~~~~~~~~~~
    	start /w /d "C:\ConfigPC\Soft\Office" /b setup.exe /configure InstallOffice2K19.xml
    cls
    goto menu1
     
    :Explorer
    cls
    echo  /!\ MODIFICATION LABEL C: /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	LABEL C: Windows10x64
    echo ~## CONFIGURATION Explorer.exe ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\02_EXPLORER.ps1
    echo /!\ AFFICHER : CE PC /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {20D04FE0-3AEA-1069-A2D8-08002B30309D} /D 0 /F
    echo /!\ AFFICHER : PANNEAU DE CONFIGURATION /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} /D 0 /F
    echo /!\ AFFICHER : FICHIERS DE L'UTILISATEUR /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {59031a47-3f72-44a7-89c5-5595fe6b30ee} /D 0 /F
    echo /!\ AFFICHER : CORBEILLE /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {645FF040-5081-101B-9F08-00AA002F954E} /D 0 /F
    echo /!\ AFFICHER : RESEAU /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /D 0 /F
    echo /!\ AFFICHER LES EXTENSIONS DE FICHIERS CONNUS /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /V HideFileExt /T REG_DWORD /D 0 /F
    echo /!\ AFFICHER LES ICONES DU SYSTRAY /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V NoAutoTrayNotify /T REG_DWORD /D 1 /F
    	REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V NoAutoTrayNotify /T REG_DWORD /D 1 /F
    echo /!\ MASQUER ICONE TASKVIEW /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V ShowTaskViewButton /T REG_DWORD /D 0 /F
    echo /!\ MASQUER CORTANA /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V ShowCortanaButton /T REG_DWORD /D 0 /F
    echo /!\ REORGANISATION AUTOMATIQUE DES ICONES DU BUREAU /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /V Fflags /T REG_DWORD /D 1075839525 /F
    echo /!\ TRANSFERT COPY DISPLAY ON /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" /V EnthusiastMode /T REG_DWORD /D 1 /F
    echo /!\ AFFICHER RUBAN EXPLORER /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Ribbon" /V MinimizedStateTabletModeOff /T REG_DWORD /D 0 /F
    echo /!\ APPARENCE - DARK MODE_ON - TRANSPARENCE_ON /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V AppsUseLightTheme /T REG_DWORD /D 0 /F
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V ColorPrevalence /T REG_DWORD /D 1 /F
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V EnableTransparency /T REG_DWORD /D 1 /F
    	REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V SystemUsesLightTheme /T REG_DWORD /D 0 /F
    	REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /V ColorPrevalence /T REG_DWORD /D 1 /F
    	REG ADD "HKEY_CURRENT_USER\Control Panel\Desktop" /V AutoColorization /T REG_DWORD /D 1 /F
    echo /!\ SUPPRESSION RACCOURCIS EDGE /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /V "DisableEdgeDesktopShortcutCreation" /T REG_DWORD /D 1 /F
    echo /!\ DESACTIVATION PROGRAMME RECENT /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" /V HideRecentlyAddedApps /T REG_DWORD /D 1 /F
    echo /!\ DESACTIVATION SUGGESTION /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /V SubscribedContent-338388Enabled /T REG_DWORD /D 0 /F
    echo /!\ DESACTIVATION JUMP LIST /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V Start_TrackDocs /T REG_DWORD /D 0 /F
    echo /!\ DESACTIVATION CENTRE DE NOTIFICATION /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer" /V DisableNotificationCenter /T REG_DWORD /D 1 /F
    	REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" /V DisableNotificationCenter /T REG_DWORD /D 1 /F
    echo /!\ MENU DEMARRER /!\
    echo ~~~~~~~~~~~~~~~~~~~~~
    	REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" /V LockedStartLayout /T REG_DWORD /D 1 /F
    	REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" /V StartLayoutFile /T REG_EXPAND_SZ /D C:\ConfigPC\Soft\StartLayout\StartLayout.xml /F
    echo ~## PIN-TO-TASKBAR ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\05_PINTOTASKBAR.ps1
    taskkill /f /im explorer.exe
    	start explorer.exe
    cls
    goto menu1
     
    :fonctionnalites
    cls
    echo ~## ACTIVATION PROTECTION DU SYSTEME ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\03_SYSTEM_PROTECTION.ps1
    echo ~## CONFIGURATION ALIMENTATION ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell	-file C:\ConfigPC\Soft\PowerShell\04_POWER_CFG.ps1
    echo ~## ACTIVATION SMB-1 ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\06_SMB1.ps1
    echo ~## ACTIVATION HYPER-V ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\07_HYPER-V.ps1
    echo ~## ACTIVATION SANDBOX ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\08_SANDBOX.ps1
    cls
    goto END
     
    :END
    echo ~## MODIFICATION NOM DU PC ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\09_RENAME_PC.ps1									
    echo /!\ REDEMARRAGE DU POSTE /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    shutdown -r -f

    Sur la seconde version, le batch appel un autre .bat pour le choix des applications.
    Par exemple, pour les applications :
    Menu principal :
    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
    :menu
    @echo off
    color E
    echo /!\ CONFIGURATION DE POSTE /!\
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cls
    echo ~~~~~CONFIGURATION PC~~~~~~~~~~~~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    echo.
    echo 1-Applications
    echo 2-Explorer.exe
    echo 3-Fonctionnalites
    echo 9-Quitter
    echo.
    set /p reponse="Quel programme voulez-vous executer ?"
     
    If /i "%reponse%"=="1" goto :applications
    If /i "%reponse%"=="2" goto :Explorer
    If /i "%reponse%"=="3" goto :fonctionnalites
    If /i "%reponse%"=="9" goto :fin
     
    :applications
    cls
    call C:\ConfigPC\Menu\Choix_Applications.bat
    cls
    goto menu
     
    :explorer
    cls
    call C:\ConfigPC\Menu\Choix_Explorer.bat
    cls
    goto menu
     
    :fonctionnalites
    cls
    call C:\ConfigPC\Menu\Choix_Functions.bat
    cls
    goto menu

    Menu de choix :
    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
    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
     
    REM Initialize
    FOR /L %%I IN (1,1,25) DO SET ITEM%%I=[ ]
     
    :Boucle
    CALL :MenuSoftware
    CALL :Valeur
     
    IF /I "%WhichItem%"=="Q" GOTO :EOF
    IF /I "%WhichItem%"=="R" GOTO RunOptions
     
    FOR /L %%I IN (1,1,25) DO IF "%%I"=="%WhichItem%" (
    	IF "!Item%WhichItem%!"=="[X]" (
    		SET Item%WhichItem%=[ ]
    	) ELSE (
    		SET Item%WhichItem%=[X]
    	)
    )
    GOTO Boucle
     
    :RunOptions
    REM Remove the ECHO from the next line to actually run the files.
    FOR /L %%I IN (1,1,25) DO IF "!Item%%I!"=="[X]" type %%I.BAT >> TEST_Menu1.bat
    call C:\ConfigPC\APPS_SOFT.bat && exit
    GOTO :EOF
     
    :MenuSoftware
    CLS
    ECHO Choisissez les logiciels que vous souhaitez installer :
    ECHO.
    ECHO %ITEM1% 01. Toutes les actions
    ECHO %ITEM2% 02. Suppression APPS Windows 10
    ECHO %ITEM3% 03. 7Zip
    ECHO %ITEM4% 04. Acrobat Reader DC
    ECHO %ITEM5% 05. Ccleaner
    ECHO %ITEM6% 06. Google Chrome
    ECHO %ITEM7% 07. DotNet_3.5
    ECHO %ITEM8% 08. Edge Chromium
    ECHO %ITEM9% 09. Mozilla Firefox
    ECHO %ITEM10% 10. Java
    ECHO %ITEM11% 11. Lenovo System Update
    ECHO %ITEM12% 12. NotePad++
    ECHO %ITEM13% 13. Skype
    ECHO %ITEM14% 14. VLC
    echo %ITEM15% 15. WinRAR
    ECHO.
    ECHO Taper Q pour Quitter
    ECHO Taper R pour lancer l'installation
    GOTO :EOF
     
    :Valeur
    ECHO.
    REM The next line has a single trailing space
    SET /P WhichItem=Faites votre choix et appuyer sur ENTER : 
    GOTO :EOF
    C'est à partir de ce menu que ça coince.
    Je souhaiterais pouvoir faire le choix "1" pour que tous les logiciels s'installent ou faire une sélection de logiciels à installer.
    La sélection fonctionne bien "visuellement" mais je ne vois pas comment faire pour l'appliquer. Et es-ce possible ?
    Le .bat des software :
    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
    @echo off
    color b
    echo ~~~~APPS AND SOFTWARE~~~~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~
    echo ~## DESINSTALLATION APPS ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    	powershell Set-ExecutionPolicy Unrestricted -Force
    		powershell -file C:\ConfigPC\Soft\PowerShell\01_REMOVEAPPS.ps1
    echo ~## 7ZIP ##~
    	echo ~~~~~~~~~~~~
    		msiexec /i "C:\ConfigPC\Soft\7Zip\7z1900.msi" /quiet
    echo ~## ACROBAT READER DC ##~
    	echo ~~~~~~~~~~~~~~~~~~~~~~~~~
    		msiexec /i "C:\ConfigPC\Soft\AcrobatDC\AcroRead.msi" /quiet
    echo ~## CCLEANER ##~
    echo ~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Ccleaner\Ccleaner565.exe /S
    		copy "C:\ConfigPC\Soft\Ccleaner\ccleaner.ini" "C:\Program Files\CCleaner"
     
    echo ~## DOTNET3.5 ##~
    echo ~~~~~~~~~~~~~~~~~
    	dism /online /enable-feature /featurename:NetFX3 /All /Source:C:\ConfigPC\Soft\DotNet /LimitAccess
    echo ~## GOOGLE CHROME ##~
    echo ~~~~~~~~~~~~~~~~~~~~~
    	msiexec /i "C:\ConfigPC\Soft\Chrome\Chrome81.msi" /qn
    echo ~## MOZILLA FIREFOX ##~
    echo ~~~~~~~~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Firefox\Firefox75.exe /s
    echo ~## JAVA ##~
    echo ~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Java\Java8u251.exe /s
    echo ~## NOTEPAD++ ##~
    echo ~~~~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\NotePad++\NotePad++785.exe /S
    echo ~## SKYPE ##~
    echo ~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\Skype\Skype_858098.exe /VERYSILENT /SP- /NOCANCEL /NORESTART /SUPPRESSMSGBOXES /NOLAUNCH
    		taskkill /f /IM Skype.exe
    echo ~## VLC ##~
    echo ~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\VLC\VLC308.exe /S
    echo ~## WINRAR ##~
    echo ~~~~~~~~~~~~~~
    	start /w C:\ConfigPC\Soft\WinRAR\WinRAR_590.exe /S
    		TIMEOUT /T 2
    			START WinRAR
    				taskkill /F /IM WinRAR.exe
    					TIMEOUT /T 2
    						COPY "C:\ConfigPC\Soft\WinRAR\REG01\rarreg.key" "C:\Users\%username%\AppData\Roaming\WinRAR\"
    							MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes"
    								MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare"
    									MD "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare\Toolbar"
    										COPY "C:\ConfigPC\Soft\WinRAR\AlienWare\Toolbar" "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare\Toolbar"
    											COPY "C:\ConfigPC\Soft\WinRAR\AlienWare" "C:\Users\%username%\AppData\Roaming\WinRAR\Themes\AlienWare"
    												COPY "C:\ConfigPC\Soft\WinRAR\Rar.exe" "C:\Windows\System32\"
    echo ~## OFFICE 2K19 ##~
    echo ~~~~~~~~~~~~~~~~~~~
    	start /w /d "C:\ConfigPC\Soft\Office" /b setup.exe /configure InstallOffice2K19.xml

    Merci d'avance pour votre aide.

  3. #3
    Expert confirmé

    Homme Profil pro
    Responsable déploiement (SCCM, InTune, GPO)
    Inscrit en
    Juillet 2014
    Messages
    3 218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Responsable déploiement (SCCM, InTune, GPO)
    Secteur : Transports

    Informations forums :
    Inscription : Juillet 2014
    Messages : 3 218
    Par défaut
    Je ne comprend pas trop ton problème

    Ce menu te convient ?
    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
    CLS
    ECHO Choisissez les logiciels que vous souhaitez installer :
    ECHO.
    ECHO %ITEM1% 01. Tous les logiciels
    ECHO %ITEM2% 02. 7Zip
    ECHO %ITEM3% 03. Acrobat Reader DC
    ECHO %ITEM4% 04. Ccleaner
    ECHO %ITEM5% 05. Google Chrome
    ECHO %ITEM6% 06. DotNet_3.5
    ECHO %ITEM7% 07. Edge Chromium
    ECHO %ITEM8% 08. Mozilla Firefox
    ECHO %ITEM9% 09. Java
    ECHO %ITEM10% 10. Lenovo System Update
    ECHO %ITEM11% 11. NotePad++
    ECHO %ITEM12% 12. Skype
    ECHO %ITEM13% 13. VLC
    ECHO.
    ECHO Taper Q pour Quitter
    ECHO Taper R pour lancer l'installation
    GOTO :EOF

    Par sélection multiple je comprend que tu souhaites pouvoir en choisir plusieurs d'un coup ? Par exemple VLC et Skype ?

    Ou un seul choix te suffit ?

  4. #4
    Expert confirmé

    Homme Profil pro
    Responsable déploiement (SCCM, InTune, GPO)
    Inscrit en
    Juillet 2014
    Messages
    3 218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Responsable déploiement (SCCM, InTune, GPO)
    Secteur : Transports

    Informations forums :
    Inscription : Juillet 2014
    Messages : 3 218
    Par défaut
    Je croit que je commence à comprendre

  5. #5
    Expert confirmé

    Homme Profil pro
    Responsable déploiement (SCCM, InTune, GPO)
    Inscrit en
    Juillet 2014
    Messages
    3 218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Responsable déploiement (SCCM, InTune, GPO)
    Secteur : Transports

    Informations forums :
    Inscription : Juillet 2014
    Messages : 3 218
    Par défaut
    Voici un exemple
    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
    65
    66
    67
    68
    69
    70
    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
     
    REM Initialize
    FOR /L %%I IN (1,1,25) DO SET ITEM%%I=[ ]
     
    :Boucle
    CLS
    ECHO Choisissez les logiciels que vous souhaitez installer :
    ECHO.
    ECHO %ITEM1% 01. Toutes les actions
    ECHO %ITEM2% 02. Suppression APPS Windows 10
    ECHO %ITEM3% 03. 7Zip
    ECHO %ITEM4% 04. Acrobat Reader DC
    ECHO %ITEM5% 05. Ccleaner
    ECHO %ITEM6% 06. Google Chrome
    ECHO %ITEM7% 07. DotNet_3.5
    ECHO %ITEM8% 08. Edge Chromium
    ECHO %ITEM9% 09. Mozilla Firefox
    ECHO %ITEM10% 10. Java
    ECHO %ITEM11% 11. Lenovo System Update
    ECHO %ITEM12% 12. NotePad++
    ECHO %ITEM13% 13. Skype
    ECHO %ITEM14% 14. VLC
    echo %ITEM15% 15. WinRAR
    ECHO.
    ECHO Taper Q pour Quitter
    ECHO Taper R pour lancer l'installation
     
    set WhichItem=
    SET /P WhichItem=Faites votre choix et appuyer sur ENTER : 
     
    IF NOT DEFINED WhichItem GOTO Boucle
    IF /I "%WhichItem%"=="Q" GOTO :EOF
    IF /I "%WhichItem%"=="R" GOTO RunOptions
     
    SET /A WhichItem=%WhichItem%
     
    FOR /L %%I IN (1,1,25) 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,25) DO IF "!Item%%I!"=="[X]" call :Item%%I
    pause
    GOTO :EOF
     
    :item1
    echo Toutes les actions
    call :item2
    call :item3
    call :item4
    GOTO :EOF
     
    :item2
    echo Suppression APPS Windows 10
    GOTO :EOF
     
    :item3
    echo 7Zip
    GOTO :EOF
     
    :item4
    echo Acrobat Reader DC
    GOTO :EOF

    Je pense que nous pouvons faire un traitement spécial pour le choix tous

  6. #6
    Expert confirmé

    Homme Profil pro
    Responsable déploiement (SCCM, InTune, GPO)
    Inscrit en
    Juillet 2014
    Messages
    3 218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Responsable déploiement (SCCM, InTune, GPO)
    Secteur : Transports

    Informations forums :
    Inscription : Juillet 2014
    Messages : 3 218
    Par défaut
    Voici comme ceci cela me parait plus simpa

    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
     
    REM Initialize
    FOR /L %%I IN (1,1,15) DO SET ITEM%%I=[ ]
     
    :Boucle
    CLS
    ECHO Choisissez les logiciels que vous souhaitez installer :
    ECHO.
    ECHO %ITEM1% 01. Toutes les actions
    ECHO %ITEM2% 02. Suppression APPS Windows 10
    ECHO %ITEM3% 03. 7Zip
    ECHO %ITEM4% 04. Acrobat Reader DC
    ECHO %ITEM5% 05. Ccleaner
    ECHO %ITEM6% 06. Google Chrome
    ECHO %ITEM7% 07. DotNet_3.5
    ECHO %ITEM8% 08. Edge Chromium
    ECHO %ITEM9% 09. Mozilla Firefox
    ECHO %ITEM10% 10. Java
    ECHO %ITEM11% 11. Lenovo System Update
    ECHO %ITEM12% 12. NotePad++
    ECHO %ITEM13% 13. Skype
    ECHO %ITEM14% 14. VLC
    echo %ITEM15% 15. WinRAR
    ECHO.
    ECHO Taper Q pour Quitter
    ECHO Taper R pour lancer l installation
     
    SET WhichItem=
    SET /P WhichItem=Faites votre choix et appuyer sur ENTER : 
     
    IF NOT DEFINED WhichItem GOTO Boucle
    IF /I "%WhichItem%"=="Q" GOTO :EOF
    IF /I "%WhichItem%"=="R" GOTO RunOptions
     
    SET /A WhichItem=%WhichItem%
     
    IF "%WhichItem%"=="1"  (
    	IF "!Item%WhichItem%!"=="[X]" (
    		FOR /L %%I IN (1,1,15) DO SET Item%%I=[ ]
    	) ELSE (
    		FOR /L %%I IN (1,1,15) DO SET Item%%I=[X]
    	)
    )
     
    FOR /L %%I IN (2,1,15) DO IF "%%I"=="%WhichItem%" (
    	IF "!Item%WhichItem%!"=="[X]" (
    		SET Item%WhichItem%=[ ]
    	) ELSE (
    		SET Item%WhichItem%=[X]
    	)
    )
     
    set Item1=[X]
    FOR /L %%I IN (2,1,15) DO IF "!Item%%I!"=="[ ]" SET Item1=[ ]
     
    GOTO Boucle
     
    :RunOptions
    FOR /L %%I IN (2,1,15) DO IF "!Item%%I!"=="[X]" call :Item%%I
    pause
    GOTO :EOF
     
    :item2
    echo Suppression APPS Windows 10
    GOTO :EOF
     
    :item3
    echo 7Zip
    GOTO :EOF
     
    :item4
    echo Acrobat Reader DC
    GOTO :EOF

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Sélection multiple dans un sous formulaire ?
    Par _developpeur_ dans le forum Access
    Réponses: 2
    Dernier message: 09/03/2019, 01h05
  2. Réponses: 2
    Dernier message: 24/08/2006, 11h33
  3. Sélection Multiple dans une JTable
    Par bobic dans le forum Composants
    Réponses: 3
    Dernier message: 07/08/2006, 17h35
  4. sélection multiple dans plusieurs zones de liste
    Par malabar92 dans le forum Access
    Réponses: 2
    Dernier message: 16/05/2006, 01h08
  5. [Débutant] Sélection multiples dans une Listbox
    Par eraim dans le forum Access
    Réponses: 4
    Dernier message: 15/10/2005, 03h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo