Comment ajouter vos connaissances

Exemple de script d'installation

    L'exemple de script de cette section installe le programme dans sa configuration standard. Pour faciliter la copie de cet exemple de script et vous permettre d'utiliser vos propres informations, les mêmes noms sont repris pour les mêmes éléments variables. Le nom du fichier journal dépend du produit que vous installez. Vous pouvez conserver le nom du fichier journal indiqué dans le script ou le modifier.

    Préfixe du numéro de série : 123

    Numéro de série : 12345678

    Cette section décrit la syntaxe d'un exemple de script simple permettant d'installer ce programme en mode silencieux.

    Installation avec script d'AutoCAD

    ' Scripted installation for AutoCAD 2012 - English 
    Option explicit
    ' Create variables 
    dim shell
    dim productType
    dim strADSKSNPrefix
    dim strADSKSNNumber
    dim strADSKProdKey
    dim strLocale
    dim strACADStandaloneNetworkType
    dim strADSKLicenseServerType
    dim strADSKLicenseType
    dim strADSKServerName
    dim strADSKServerPath
    dim strADSKServerHostID
    dim strADSKPath
    dim strSourcePath
    ' 
    ' Script initialization
    Set shell = CreateObject("WScript.Shell")
    productType = "ACAD"
    ' Serial Number information
    strADSKSNPrefix = "123" 
    strADSKSNNumber = "12345678"
    strADSKProdKey="ABCDE"
    'Locale information, for example en-US = US English, de-DE = Deutchland German, ja-JP = Japan Japanese
    strLocale="en-US" ' en-US, de-DE, ja-JP
    '
    ' Source to install from (e.g. D: is assumed to be Install Media) 
    strSourcePath = "D:\"
    '
    ' Destination to install to 
    strADSKPath = Shell.ExpandEnvironmentStrings("%ProgramFiles%") + "\Autodesk\" + "AutoCAD 2012" 
    If strLocale <> "" Then strADSKPath = strADSKPath + " " + strLocale
    strADSKPath = strADSKPath + "\"
    
    ' Uncomment the relevant version of your installation - Default is Standalone 
    ' For Standalone 
    RunStandaloneInstall() 
    ' 
    ' For Single Network License Server
    'RunSingleLicenseServerInstall() 
    '
    ' End of Script
    Wscript.quit()
    '
    Function RunStandaloneInstall 
      shell.run DefaultCommand(),2,1 
    end function
    '
    Function RunSingleLicenseServerInstall 
    ' Update with the correct information for the license server
    strACADStandaloneNetworkType = "3" 
    strADSKLicenseServerType = "Single Server License" 
    strADSKLicenseType = "Network License" 
    strADSKServerPath = "myFlexNetServer" 
    ' HOSTID or MAC address
    strADSKServerHOSTID = "000000000000"
    '
    ' Consolidate the two values 
    strADSKServerPath = strADSKServerPath & " " & strADSKServerHOSTID
    shell.run MakeCommand(),2,1 
    end function
    '
    Function DefaultCommand 
    dim retString 
    ' /qb for silent install ' /c [key] override parameters for the key 
    ' /w wait until installation completes before returning to script
    ' /o reboot after install completes
    retString = """" & strSourcePath & "\setup.exe" & """" & " /t /qb " 
    If strLocale <> "" then
            retString = retString & "/Language " & strLocale 
    End if
    retString = retString & " /c " & productType & ": " 
    retString = retString & "INSTALLDIR=" & """" & strADSKPath & """" & " " 
    retString = retString & "ACADSERIALPREFIX=" & strADSKSNPrefix & " " 
    retString = retString & "ACADSERIALNUMBER=" & strADSKSNNumber & " " 
    retString = retString & "ADLM_PRODKEY=" & strADSKProdKey & " " 
    retString = retString & "InstallLevel=5 " 
    DefaultCommand = retString & " " 
    end function
    '
    Function MakeCommand 
    dim retString 
    retString = DefaultCommand() & " " 
    retString = retString & "ACADSTANDALONENETWORKTYPE=" & """" & strACADStandaloneNetworkType & """" & " " 
    retString = retString & "ACADLICENSESERVERTYPE=" & """" & strADSKLicenseServerType & """" & " " 
    retString = retString & "ACADLICENSETYPE=" & """" & strADSKLicenseType & """" & " " 
    retString = retString & "ACADSERVERPATH=" & """" & strADSKServerPath & """" & " " 
    MakeCommand = retString 
    end function