Bonjour,
Essayes peut-être ceci en plaçant tes KB à la racine de ton paquet :
def install(): val = windows_version() print(val) script_path = os.getcwd() print(script_path) if val == '10.0.19042': print('20H2') run(r'wusa.exe %s\windows10.0-kb5001649-2004-20H2.msu /quiet /norestart' %script_path) elif val == '10.0.18363': print('1909') run(r'wusa.exe %s\windows10.0-kb5001648-1909.msu /quiet /norestart' %script_path)
Je ne sais pas comment faire un équivalent de switch/case en python pour faire plus propre que le if/else if.
Cordialement, *Jérôme DUPUIS* /TSH Informatique/ *Centre Hospitalier d'Abbeville* 43 Rue de l'Isle, 80142 ABBEVILLE ✆*03 22 25 57 65 / 03 22 25 52 40* ✉dupuis.jerome@ch-abbeville.fr mailto:dupuis.jerome@ch-abbeville.fr
Le 07/04/2021 à 21:53, markham89 a écrit :
Bonjour,
je cherche a faire une version wapt (python) de mon script batch
quelle instruction via la lib wapt/python me permet de recupere la build comme le fait mon script?
:
@echo off echo installation patch imprimante for /f "tokens=4-7 delims=[.] " %%i in ('ver') do @(if %%i==Version (set version=%%j.%%k.%%l) else (set version=%%i.%%j.%%k))
if "%version%" == "10.0.19042" (GOTO :20H2) if "%version%" == "10.0.19041" (GOTO :2004) if "%version%" == "10.0.18363" (GOTO :1909) if "%version%" == "10.0.18362" (GOTO :1903) if "%version%" == "10.0.17763" (GOTO :1809) if "%version%" == "10.0.17134" (GOTO :1803)
:20H2 echo Version Windows 10 Version 20H2 detectee echo installation du patch : wusa.exe windows10.0-kb5001649-2004-20H2.msu /quiet /norestart GOTO END
:2004 echo Windows 10 Version 2004 detectee echo installation du patch : wusa.exe windows10.0-kb5001649-2004-20H2.msu /quiet /norestart GOTO END
:1909 echo Windows 10 Version 1909 detectee echo installation du patch : wusa.exe windows10.0-kb5001648-1909.msu /quiet /norestart GOTO END
:1903 echo Windows 10 Version 1903 detectee GOTO END
:1809 echo Windows 10 Version 1809 detectee echo installation du patch : wusa.exe windows10.0-kb5001638-1809.msu /quiet /norestart GOTO END
:1803 echo Windows 10 Version 1803 detectee echo installation du patch : GOTO END
:END exit
Merci;
WAPT mailing list WAPT@lists.tranquil.it http://lists.tranquil.it/listinfo/wapt