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

VBScript Discussion :

excécution d'un batch a partir d'un boutton HTA


Sujet :

VBScript

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 51
    Par défaut excécution d'un batch a partir d'un boutton HTA
    Bonjour,

    Voila, je suis en train de faire un petit programme pour mon boulot, et j'aimerais savoir si il est possible d’exécuter un fichier batch a partir d'un fichier HTA tous en incorprant les variables dans le batch

  2. #2
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut
    Citation Envoyé par mavric35830 Voir le message
    Bonjour,

    Voila, je suis en train de faire un petit programme pour mon boulot, et j'aimerais savoir si il est possible d’exécuter un fichier batch a partir d'un fichier HTA tous en incorprant les variables dans le batch

    Votre code postez-le

  3. #3
    Membre averti
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 51
    Par défaut
    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
    <html>
    <HEAD>
    <TITLE>Installation du pack de sérucité</TITLE>
     
     
    <HTA:APPLICATION
            applicationname="Package installation"
    	border="thin"	
            borderstyle="sunken"
    	caption="yes" 
            contextmenu="no"
    	id="oHTA" alert(oHTA.applicationName);
    	innerborder="yes" 
            maximizebutton="no" 
            minimizebutton="no"
    	navigable="no" 
            scroll="no" 
            scrollflat="no"
    	selection="no"	
            showintaskbar="yes" 
            singleinstance="no"
    	sysmenu="yes" 
            version="1.5" 
            SHOWINTASKBAR="no"
            windowstate="normal" />
     
     </HEAD>
     
     
     <script language="VBScript">
          Sub sites
               MsgBox "Installationsur pack de sécurité pour l'utilisateur "&user.value&" avec le mot de passe :"&pwd.value&" avec le compte : "&login.value,vbExclamation,"Confirmation"
               if site.value=" " then MsgBox "Veuillez sélectionner un site",vbExclamation,"Confiormation"
               if site.value="ville1" then MsgBox "le hostname est FRLANN0"&asset.value,vbExclamation,"Confiormation"
               if site.value="ville2" then MsgBox "le hostname est FRORVN0"&asset.value,vbExclamation,"Confiormation"
               if site.value="ville3" then MsgBox "le hostname est FRRENN0"&asset.value,vbExclamation,"Confiormation"
     
     
          End Sub
     </SCRIPT>
    <BODY>
    Saisir le login EMEA du support : <INPUT TYPE="text" NAME="login" SIZE="20" MAXLENGTH="30" VALUE=" ">
    Saisir le mot de passe : <INPUT TYPE="password" NAME="pwd" SIZE="20" MAXLENGTH="30" VALUE="">
    <br><br>
        Sélectionner le site : <SELECT NAME="site" SIZE=1 onChange=" ">
          <OPTION VALUE=" " SELECTED>
          <OPTION VALUE="ville1">ville1
          <OPTION VALUE="ville2">ville2
          <OPTION VALUE="ville3">ville3
        </SELECT> 
     
    <BR><BR>
    Saisir le login EMEA de l'utilisateur : <INPUT TYPE="text" NAME="user" SIZE="20" MAXLENGTH="30" VALUE=" ">
    <br><BR>
    Saisir le N° ASSET: <INPUT TYPE="text" NAME="asset" SIZE="20" MAXLENGTH="7" VALUE="">
      <input type="button" name="sites" value="Installation" onClick="sites" >
     
     
    </BODY>
     
    </html>
    Et donc, j'aimerais récupérer les variable dans un bacth que je lance au moment ou j'appuie sur le bouton INSTALLATION

  4. #4
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut
    Bon je n'ai pas encore vu le batch ; mais pourquoi pas vous n'utilisez plutôt du vbscript et HTA au lieu du Batch et HTA ?

  5. #5
    Membre averti
    Homme Profil pro
    Inscrit en
    Juin 2012
    Messages
    51
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Juin 2012
    Messages : 51
    Par défaut
    Car en faite, le script batch existe déja et j'aimerais l'adapter dans le HTA
    et voici le batch en question
    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
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    @echo ******************************************
    @echo * begining of security pack installation *
    @echo ******************************************
     
    :START
    @start  "installation du pack de sécirité" /B ..\data\nouveau1.hta
     
    @echo *
    @echo * enter le numero du site de location: (LANNION=1, ORVAULT=2, RENNES=3)
    @set /p site=
    @if %site%==1 (set siteloc=frlann0) && (set localsrv=FRLANSCCM032) && (set ou=FRLAN) && goto SITOK 
    @if %site%==2 (set siteloc=frorvn0) && (set localsrv=FRORVSSMS03) && (set ou=FRORV) && goto SITOK
    @if %site%==3 (set siteloc=frrenn0) && (set localsrv=FRRENSCCM003) && (set ou=FRREN) && goto SITOK
    goto START
     
    :SITOK
    @echo *
    @echo *******************************
    @echo * entrer le compte admin EMEA *
    @echo *******************************
    @set /p login=
    @echo entrer le mote de passe A1cive directory pour: emea\%login%
    @c:\temp\securpak\bin\editv32 -m passwd
    @net use Z: \\%localsrv%\packages %passwd% /user:EMEA\%login% 
    @echo *
    @echo * Arret du FireWall Windows XP
    @%systemroot%\system32\sc stop SharedAccess
    @%systemroot%\system32\sc config SharedAccess start= disabled
    @echo *
    @echo * copying packages to [c:\temp\secpack] on local computer
    @if exist "c:\temp\securpak" goto RCOPY
    @md c:\temp\securpak
     
    :RCOPY
    @set program=\securpak\bin\robocopy.exe
    @set pserver=\securpak
    @set pkginst=c:\temp\securpak
    @for %%i in (\bin,\cmd,\data) do (
    @"%program%" "%pserver%%%i" "%pkginst%%%i" /mir /r:0 /w:0 /V /NFL /NDL)
    @set pserver=\\%localsrv%\automation\Packages
    @set dirpkg=SCCMCLIENT_2007SP2
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=WINDOWSINSTALLER_45
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=MCAFEEVIRUSSCAN_87
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=MCAFEEHIPS_70
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=EPOAGENT_FOR45
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=ICACLIENT_11
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=Firefox_7
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=Thunderbird_2x
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
    @set dirpkg=IPSECCLIENT_101
    @"%program%" "%pserver%\%dirpkg%" "%pkginst%\%dirpkg%" /mir /r:0 /w:0 /V /NFL /NDL
     
     
    pause
    :INPUT
    @echo *
    @echo * setting required information 
    @set admgrp=administrateurs
    @echo *
    @echo * entrer le compte utilisateur EMEA
    @set /p logusr=
    @echo *
    @echo * entrer le Numero ASSET de l'ordinateur
    @set /p asset=
    @echo *
    @echo login EMEA  = %logusr%
    @echo Numero Asset = %asset%
    @echo Hostname = %siteloc%%asset%
    @echo *
    @echo *
    @c:\temp\securpak\bin\choice /C:YN /N * do Login et Hostmane correct [Y,N] :
    @if errorlevel 2 goto INPUT
     
    @set host=%siteloc%%asset%
    @echo *
    @echo the folowing hostname will be used: %host%
    @echo *
    @echo inscription de l ordinateur dans l'active directory
    @c:\temp\securpak\bin\DSADD COMPUTER "CN=%computername%,OU=%ou%,OU=FR,OU=WKST,DC=EMEA,DC=LUCENT,DC=COM" -d EMEA.LUCENT.COM -u %login% -p %passwd%
    @echo * Joining computer to EMEA domain
    @c:\temp\securpak\bin\netdom join  %computername% /domain:emea.lucent.com /userD:emea\%login% /passwordD:%passwd%
    @c:\temp\securpak\bin\sleep 3
    @echo *
    @echo * Renaming computer with given asset
    @c:\temp\securpak\bin\netdom RENAMECOMPUTER %computername% /newname:%host% /userD:emea\%login% /passwordD:%passwd% /force
    @c:\temp\securpak\bin\sleep 3
    @echo *
    @echo * Setting security group for france
    @net localgroup > c:\temp\securpak\group.txt
    @c:\temp\securpak\bin\find /i "administrateurs" c:\temp\securpak\group.txt >nul
    @if errorlevel 1 set admgrp=administrators
    @echo *
    @echo * On this computer ther's %admgrp%
    @net localgroup %admgrp% EMEA\SEC_DL_WKS_ADM_EMEA /ADD
    @net localgroup %admgrp% EMEA\SEC_DL_WKS_ADM_FR /ADD
    @c:\temp\securpak\bin\sleep 3
    @echo *
    @echo * Setting user %logusr% in admin group
    @net localgroup %admgrp% EMEA\%logusr% /ADD
    @c:\temp\securpak\bin\sleep 3
    @echo *
    @echo * Setting time according to DC
    @%systemroot%\system32\net time /setsntp:135.120.32.53
    @echo *
    @echo * Adding network suffix search list
    @set regkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
    @%systemroot%\system32\reg add %regkey% /v SearchList /t REG_SZ /D "fr.alcatel-lucent.com,wins.lucent.com,emea.lucent.com,na02.lucent.com,lucent.com,ap01.lucent.com,srv.eu.alcatel.com,dc-m.alcatel-lucent.com,res1.alcatel-lucent.com,ndc.lucent.com,alcatel-lucent.com,or.cit.alcatel.fr,vz.cit.alcatel.fr,vx.cit.alcatel.fr,ln.cit.alcatel.fr,om.cit.alcatel.fr,netfr.alcatel.fr,fr.alcatel-lucent.com" /f
    @c:\temp\securpak\bin\sleep 3
    pause
    @echo *
    @echo * Setting netlogon and lmhosts svc in auto mode
    @%systemroot%\system32\sc config netlogon start = auto
    @%systemroot%\system32\sc config lmhosts start = auto
    @echo *
    @echo * Setting checksign key to no for .default user
    @set regkey="HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\Download"
    @%systemroot%\system32\reg add %regkey% /v CheckExeSignatures /t REG_SZ /d "no" /f
    @echo *
    @echo * Checking if windows installer is installed
    @if exist %systemroot%\system32\msiexec.exe goto SUITE
    @echo *
    @echo * Processing installation of windows installer
    @Start /wait /i /dc:\temp\securpak\WINDOWSINSTALLER_45 WINDOWSINSTALLER_45.EXE force
    @c:\temp\securpak\bin\sleep 3
    :SUITE
    @if not exist %SystemRoot%\packman md %SystemRoot%\PACKMAM
    @if not exist %SystemRoot%\packman\LOGS md %SystemRoot%\packman\LOGS
    @if not exist %SystemRoot%\packman\CONF md %SystemRoot%\packman\CONF
    @if %site% == 1 (@copy /y c:\temp\securpak\data\siteini.lan %SystemRoot%\packman\CONF\site.ini && goto INSPAK)
    @if %site% == 2 (@copy /y c:\temp\securpak\data\siteini.orv %SystemRoot%\packman\CONF\site.ini && goto INSPAK)
    @if %site% == 3 (@copy /y c:\temp\securpak\data\siteini.ren %SystemRoot%\packman\CONF\site.ini && goto INSPAK)
    :INSPAK
    @c:\temp\securpak\bin\sleep 10
    @echo *
    @echo >nul
    @echo *	Security packages installation started
     
    @echo *
    @echo *	Processing installation of SCCM CLIENT
    @cd /d C:\temp\securpak\SCCMCLIENT_2007SP2
    @runner.exe man install SCCMCLIENT_2007SP2.exe force
    @cd c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of Mcafee antivirus
    @cd /d c:\temp\securpak\MCAFEEVIRUSSCAN_87
    @runner.exe man install MCAFEEVIRUSSCAN_87.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of EPO agent
    @cd /d c:\temp\securpak\EPOAGENT_FOR45
    @runner.exe man install EpoAgent_for45.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of ICA client
    @cd /d c:\temp\securpak\ICACLIENT_11
    @runner.exe man install ICAClient_11.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of Firefox
    @cd /d c:\temp\securpak\Firefox_7
    @runner.exe man install Firefox_7.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of Thunderbird
    @cd /d c:\temp\securpak\Thunderbird_2x
    @runner.exe man install Thunderbird_2x.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of Mcafee FireWALL
    @cd /d c:\temp\securpak\MCAFEEHIPS_70
    @runner.exe man install McAfeeHIPS_70.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo *	Processing installation of IPseclient
    @cd /d c:\temp\securpak\IPSECCLIENT_101
    @runner.exe man install IPSecClient_101.EXE force
    @c:\temp\securpak\bin\sleep 10
     
    @echo *
    @echo * Installation du proxy
    @reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ /v "AutoConfigURL" /t REG_SZ  /d "http://gautoconf.alcatel.fr/proxy.pac" /f

Discussions similaires

  1. [Toutes versions] Execution d'un fichier batch a partir de VBA Access
    Par jj4822 dans le forum VBA Access
    Réponses: 6
    Dernier message: 13/03/2019, 11h20
  2. Réponses: 8
    Dernier message: 04/07/2013, 18h12
  3. Comment executer un script batch distant à partir de mon poste
    Par arnaudperfect dans le forum Windows Serveur
    Réponses: 1
    Dernier message: 19/11/2007, 12h03
  4. Réponses: 1
    Dernier message: 30/01/2007, 09h19
  5. AFFICHER DANS UNE LISTE à PARTIR D'UN BOUTTON
    Par au_record dans le forum JBuilder
    Réponses: 1
    Dernier message: 10/04/2006, 15h59

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