So fügen Sie Ihr Wissen hinzu

Beispiel für ein Installationsskript

    Das in diesem Abschnitt beschriebene Beispielskript installiert das Programm in einer Standardkonfiguration. Damit es für Sie einfacher ist, das Beispielskript zu kopieren und Ihre eigenen Informationen einzufügen, werden für die Variablenelemente immer die gleichen Namen verwendet. Der Name der Protokolldatei basiert auf dem installierten Produkt. Sie können den im Skript verwendeten Protokolldateinamen verwenden oder ihn beliebig ändern.

    Seriennummer-Präfix: 123

    Seriennummer: 12345678

    Ein Beispielskript für die automatische Installation dieses Programms verwendet die in diesem Abschnitt aufgeführte Syntax.

    Skriptbasierte Installation von 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