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 :

Convertir en AutoIT


Sujet :

Scripts/Batch

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Technicien réseaux et télécoms
    Inscrit en
    Août 2018
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Drôme (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien réseaux et télécoms

    Informations forums :
    Inscription : Août 2018
    Messages : 24
    Par défaut Convertir en AutoIT
    bonjour,

    quelqu'un est il capable de convertir ce batch en AutoIT ?

    Code : 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
    rem ================================ CHANGEMENT NOM POSTE ==============================
    :hostname
    rem ============ AFFICHE NOM POSTE ACTUEL =============
    set $name=%computername%
    cls
    Title Nom actuel du poste
    (
        echo    Answ = MsgBox("Nom:  %$name% . Voulez vous changer ?",VbYesNo+VbQuestion,"Redemarrer"^)
        echo    If Answ = VbYes then
        echo        wscript.Quit(0^)
        echo    Else
        echo        wscript.Quit(1^)
        echo    End If
    )>"%~dp0\tmp\hostname.vbs"
     
    cscript.exe //nologo %~dp0\tmp\hostname.vbs
    IF "%errorlevel%"=="1" ( goto :menu1 ) else ( goto :inputpc )
    cls
    
    
    :inputpc
    rem ### FENETRE INPUT #######
    Title Changement nom de poste
    cls
    echo.
    if not exist "%~dp0\config\pcname.vbs" goto :constructpc
    for /f "delims=" %%a in ('cscript.exe /nologo %~dp0\config\pcname.vbs') do set pcname=%%a
    if "%pcname%"=="" (goto :errorpc) else echo Nom du Poste: =^> %pcname%
       
    :constructpc
    (echo tag = InputBox("Nom du Poste" , "CHANGEMENT PC NAME"^) & echo wscript.echo(tag^))>%~dp0\config\pcname.vbs
    echo.
    echo.
    goto :detectos
    
    
    
    rem ==================== DETECTION OS ============================
    
    :detectos
    ver | find "5.1" > nul
     
    if errorlevel = 1 goto next0
    if errorlevel = 0 goto xp
     
    :next0
    ver | find "6.0" > nul
    if errorlevel = 1 goto next
    if errorlevel = 0 goto win vista
     
    :next
    ver | find "6.1"
    if errorlevel = 1 goto next1
    if errorlevel = 0 goto win7
     
    :next1
    ver | find "6.2" > nul
    if errorlevel = 1 goto next2
    if errorlevel = 0 goto win8
     
    :next2
    ver | find "6.3" > nul
    if errorlevel = 1 goto next3
    if errorlevel = 0 goto win8.1
     
    :next3
    ver | find "6.3" > nul
    if errorlevel = 1 goto next4
    if errorlevel = 0 goto win8.1
     
    :next4
    ver | find "10.0" > nul
    if errorlevel = 1 goto other
    if errorlevel = 0 goto win10
     
    :xp
    echo msgbox "OS: Windows XP" > %~dp0\tmp\winxp.vbs
    cscript /nologo %~dp0\tmp\winxp.vbs
    del %~dp0\tmp\winxp.vbs
    goto :pcnamexp
     
    :win vista
    echo msgbox "OS: Windows Vista" > %~dp0\tmp\winvista.vbs
    cscript /nologo %~dp0\tmp\winvista.vbs
    del %~dp0\tmp\winvista.vbs
    goto :pcnamevista
      
    :win7
    echo msgbox "OS: Windows 7" > %~dp0\tmp\win7.vbs
    cscript /nologo %~dp0\tmp\win7.vbs
    del %~dp0\tmp\win7.vbs
    goto :pcname7
     
    :win8
    echo msgbox "OS: Windows 8" > %~dp0\tmp\win8.vbs
    cscript /nologo %~dp0\tmp\win8.vbs
    del %~dp0\tmp\win8.vbs
    goto :pcname8
     
    :win8.1
    echo msgbox "OS: Windows 8.1" > %~dp0\tmp\win81.vbs
    cscript /nologo %~dp0\tmp\win81.vbs
    del %~dp0\tmp\win81.vbs
    goto :pcname81
     
    :win10
    echo msgbox "OS: Windows 10" > %~dp0\tmp\win10.vbs
    cscript /nologo %~dp0\tmp\win10.vbs
    del %~dp0\tmp\win10.vbs
    goto :pcname10
    
    :other
    echo msgbox "OS: Indefini" > %~dp0\tmp\other.vbs
    cscript /nologo %~dp0\tmp\other.vbs
    del %~dp0\tmp\other.vbs
    goto :menu1
    
    rem ===============================================================
    rem ======= NAME ERROR =======
    :pcerror
    echo msgbox "Modification impossible, retour Menu" > %~dp0\tmp\noos.vbs
    cscript /nologo %~dp0\tmp\noos.vbs
    del %~dp0\tmp\noos.vbs
    goto :menu1
    rem ==========================
    
    rem =============== NAME WINDOWS XP ===================
    :pcnamexp
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem =============== NAME WINDOWS VISTA ===================
    :pcnamevista
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem =============== NAME WINDOWS 8 ===================
    :pcname8
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem =============== NAME WINDOWS 8.1 ===================
    :pcname81
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem =============== NAME WINDOWS 7 ===================
    :pcname7
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem =============== NAME WINDOWS 10 ==================
    :pcname10
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "HostName" /d "%pcname%" /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" /v "NV HostName" /d "%pcname%" /f
    goto :popname
    rem ==================================================
    
    rem ==== POP UP NAME ====
    :popname
    echo msgbox "Nouveau Nom: %pcname%" > %~dp0\tmp\pcname.vbs
    cscript /nologo %~dp0\tmp\pcname.vbs
    del %~dp0\tmp\pcname.vbs
    goto :menuname
    rem =====================
    Cordialement

  2. #2
    Membre Expert
    Avatar de sachadee
    Homme Profil pro
    AMI DU BAT
    Inscrit en
    Janvier 2013
    Messages
    1 478
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Brésil

    Informations professionnelles :
    Activité : AMI DU BAT
    Secteur : Distribution

    Informations forums :
    Inscription : Janvier 2013
    Messages : 1 478
    Par défaut
    En autoit tu as la formidable variable :

    @OSversion


    donc ton script va faire maximum 5 lignes


Discussions similaires

  1. Réponses: 4
    Dernier message: 06/06/2004, 12h07
  2. [QuickReport] convertir les états en RAVE
    Par El blérot dans le forum Rave
    Réponses: 5
    Dernier message: 18/03/2004, 17h05
  3. Réponses: 3
    Dernier message: 02/07/2003, 16h24
  4. [TP]Convertir Delphi en BP7
    Par Christophe Fantoni dans le forum Turbo Pascal
    Réponses: 28
    Dernier message: 19/11/2002, 17h30
  5. convertir un nom long (win32) en format dos (8+3)
    Par kylekiller dans le forum Langage
    Réponses: 2
    Dernier message: 30/08/2002, 13h34

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