Lo script di esempio riportato in questa sezione consente di installare il programma in una configurazione tipica. Per semplificare la copia di questo script e la sostituzione delle informazioni in base ai casi specifici, sono stati utilizzati sempre gli stessi nomi per le variabili. Il nome del file di registro si basa sul prodotto che viene installato. È possibile utilizzare il nome del file di registro oppure modificarlo.
Prefisso del numero di serie: 123
Uno script di esempio per un'installazione in modalità batch del programma utilizza la sintassi illustrata in questa sezione.
' 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