WinBatch: Nicht alle Variablen werden richtig eingesetzt...?

Antworten
seteqsystems
Beiträge: 62
Registriert: 12 Sep 2012, 11:51
Wohnort: Hall in Tirol

WinBatch: Nicht alle Variablen werden richtig eingesetzt...?

Beitrag von seteqsystems »

Hallo,

Ich wollte mal fragen, wie es sein kann, dass in einer Winbatch-Sektion nur gewisse Variablen eingesetzt werden?
Man beachte im Log die allerletzte Zeile bei Executed process: ... ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ... !??

Folgender Skriptcode:

Code: Alles auswählen

DefVar $Profile$
DefVar $Location$
DefVar $LicServer$
DefVar $InstCmd$
Set $Profile$ = GetProductProperty("profile", "_")
Set $Location$ = GetProductProperty("location", "_")

DefVar $Basepath$
if not ($Profile$ = "_")
  Set $Basepath$ = "G:\Programmeinstellungen\Autodesk\AutoCAD\" + $Profile$ + "\"
endif

if $Location$ = "Tirol"
  Set $LicServer$ = "ATLICACAD101"
endif
if $Location$ = "Wien"
  Set $LicServer$ = "ATLICACAD201"
endif
if $Location$ = "Graz"
  Set $LicServer$ = "ATLICACAD301"
endif
if $Location$ = "Muenchen"
  Set $LicServer$ = "DELICACAD101"
endif

Code: Alles auswählen

	;== AutoCAD 2013 - Deutsch (German)
	Message "Installing (16/20) AutoCAD 2013"
	Set $InstCmd$='msiexec /i %scriptpath%\AdminImage\x64\acad\acad.msi TRANSFORMS="%scriptpath%\AdminImage\x64\de-de\acad\acad.mst;%scriptpath%\AdminImage\x64\acad\acad-BI.mst" ADSK_EULA_STATUS=#1 MUILANG=de-de ADSK_SOURCE_ROOT="%scriptpath%\AdminImage\" INSTALLDIR="C:\Program Files\Autodesk\AutoCAD 2013\" FILESINUSETEXT="" REBOOT=ReallySuppress ADSK_SETUP_EXE=1 ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ACADProfile_PrinterConfigDir="$Basepath$plotters" ACADProfile_PrinterDescDir="$Basepath$plotters\PMP Files" ACADProfile_PrinterStyleSheetDir="$Basepath$Plot Styles" ACADProfile_SupportPath="$BasePath$support;[INSTALLDIR]support;[INSTALLDIR]fonts;[INSTALLDIR]help;[INSTALLDIR]Express;[INSTALLDIR]support\color" ACADProfile_TemplatePath="$BasePath$Templates" /qb-!'
	Winbatch_Install

[Winbatch_Install]
$InstCmd$

Das Log dazu:

Code: Alles auswählen

[5] [12.12.2012 08:24:48] Set  $Profile$ = GetProductProperty("profile", "_")
[6] [12.12.2012 08:24:48]   The value of the variable "$Profile$" is now: "Energie_Infrastruktur"
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] Set  $Location$ = GetProductProperty("location", "_")
[6] [12.12.2012 08:24:48]   The value of the variable "$Location$" is now: "Tirol"
[6] [12.12.2012 08:24:48] wInst has version  4.11.2.9, required is : >= 4.11
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] If
[5] [12.12.2012 08:24:48]   $Profile$ = "_"   <<< result false
[5] [12.12.2012 08:24:48]   not ($Profile$ = "_")   <<< result true
[5] [12.12.2012 08:24:48] Then
[5] [12.12.2012 08:24:48]   
[5] [12.12.2012 08:24:48]   Set  $Basepath$ = "G:\Programmeinstellungen\Autodesk\AutoCAD\" + $Profile$ + "\"
[6] [12.12.2012 08:24:48]     The value of the variable "$Basepath$" is now: "G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\"
[5] [12.12.2012 08:24:48] EndIf
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] If
[5] [12.12.2012 08:24:48]   $Location$ = "Tirol"   <<< result true
[5] [12.12.2012 08:24:48] Then
[5] [12.12.2012 08:24:48]   
[5] [12.12.2012 08:24:48]   Set  $LicServer$ = "ATLICACAD101"
[6] [12.12.2012 08:24:48]     The value of the variable "$LicServer$" is now: "ATLICACAD101"
[5] [12.12.2012 08:24:48] EndIf
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] If
[5] [12.12.2012 08:24:48]   $Location$ = "Wien"   <<< result false
[5] [12.12.2012 08:24:48] Then
[5] [12.12.2012 08:24:48] EndIf
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] If
[5] [12.12.2012 08:24:48]   $Location$ = "Graz"   <<< result false
[5] [12.12.2012 08:24:48] Then
[5] [12.12.2012 08:24:48] EndIf
[5] [12.12.2012 08:24:48] 
[5] [12.12.2012 08:24:48] If
[5] [12.12.2012 08:24:48]   $Location$ = "Muenchen"   <<< result false
[5] [12.12.2012 08:24:48] Then
[5] [12.12.2012 08:24:48] EndIf

[......]

[5] [12.12.2012 08:29:39]   message Installing (16/20) AutoCAD 2013
[5] [12.12.2012 08:29:39]   
[5] [12.12.2012 08:29:39]   Set  $InstCmd$='msiexec /i P:\acad2013\AdminImage\x64\acad\acad.msi TRANSFORMS="P:\acad2013\AdminImage\x64\de-de\acad\acad.mst;P:\acad2013\AdminImage\x64\acad\acad-BI.mst" ADSK_EULA_STATUS=#1 MUILANG=de-de ADSK_SOURCE_ROOT="P:\acad2013\AdminImage\" INSTALLDIR="C:\Program Files\Autodesk\AutoCAD 2013\" FILESINUSETEXT="" REBOOT=ReallySuppress ADSK_SETUP_EXE=1 ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ACADProfile_PrinterConfigDir="$Basepath$plotters" ACADProfile_PrinterDescDir="$Basepath$plotters\PMP Files" ACADProfile_PrinterStyleSheetDir="$Basepath$Plot Styles" ACADProfile_SupportPath="$BasePath$support;[INSTALLDIR]support;[INSTALLDIR]fonts;[INSTALLDIR]help;[INSTALLDIR]Express;[INSTALLDIR]support\color" ACADProfile_TemplatePath="$BasePath$Templates" /qb-!'
[6] [12.12.2012 08:29:39]     The value of the variable "$InstCmd$" is now: "msiexec /i P:\acad2013\AdminImage\x64\acad\acad.msi TRANSFORMS="P:\acad2013\AdminImage\x64\de-de\acad\acad.mst;P:\acad2013\AdminImage\x64\acad\acad-BI.mst" ADSK_EULA_STATUS=#1 MUILANG=de-de ADSK_SOURCE_ROOT="P:\acad2013\AdminImage\" INSTALLDIR="C:\Program Files\Autodesk\AutoCAD 2013\" FILESINUSETEXT="" REBOOT=ReallySuppress ADSK_SETUP_EXE=1 ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ACADProfile_PrinterConfigDir="$Basepath$plotters" ACADProfile_PrinterDescDir="$Basepath$plotters\PMP Files" ACADProfile_PrinterStyleSheetDir="$Basepath$Plot Styles" ACADProfile_SupportPath="$BasePath$support;[INSTALLDIR]support;[INSTALLDIR]fonts;[INSTALLDIR]help;[INSTALLDIR]Express;[INSTALLDIR]support\color" ACADProfile_TemplatePath="$BasePath$Templates" /qb-!"
[5] [12.12.2012 08:29:39]   
[5] [12.12.2012 08:29:39]   Execution of Winbatch_Install
[6] [12.12.2012 08:29:39]     Call "msiexec /i P:\acad2013\AdminImage\x64\acad\acad.msi TRANSFORMS="P:\acad2013\AdminImage\x64\de-de\acad\acad.mst;P:\acad2013\AdminImage\x64\acad\acad-BI.mst" ADSK_EULA_STATUS=#1 MUILANG=de-de ADSK_SOURCE_ROOT="P:\acad2013\AdminImage\" INSTALLDIR="C:\Program Files\Autodesk\AutoCAD 2013\" FILESINUSETEXT="" REBOOT=ReallySuppress ADSK_SETUP_EXE=1 ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ACADProfile_PrinterConfigDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\plotters" ACADProfile_PrinterDescDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\plotters\PMP Files" ACADProfile_PrinterStyleSheetDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\Plot Styles" ACADProfile_SupportPath="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\support;[INSTALLDIR]support;[INSTALLDIR]fonts;[INSTALLDIR]help;[INSTALLDIR]Express;[INSTALLDIR]support\color" ACADProfile_TemplatePath="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\Templates" /qb-!"
[6] [12.12.2012 08:29:39]        Waiting until the called process is finished
[6] [12.12.2012 08:32:18]     ExitCode 0    Executed process "msiexec /i P:\acad2013\AdminImage\x64\acad\acad.msi TRANSFORMS="P:\acad2013\AdminImage\x64\de-de\acad\acad.mst;P:\acad2013\AdminImage\x64\acad\acad-BI.mst" ADSK_EULA_STATUS=#1 MUILANG=de-de ADSK_SOURCE_ROOT="P:\acad2013\AdminImage\" INSTALLDIR="C:\Program Files\Autodesk\AutoCAD 2013\" FILESINUSETEXT="" REBOOT=ReallySuppress ADSK_SETUP_EXE=1 ACADDEFAULTPROFILENAME="$Location$ - $Profile$" ACADSERVERFMTPATH="$LicServer$" ACADProfile_PrinterConfigDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\plotters" ACADProfile_PrinterDescDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\plotters\PMP Files" ACADProfile_PrinterStyleSheetDir="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\Plot Styles" ACADProfile_SupportPath="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\support;[INSTALLDIR]support;[INSTALLDIR]fonts;[INSTALLDIR]help;[INSTALLDIR]Express;[INSTALLDIR]support\color" ACADProfile_TemplatePath="G:\Programmeinstellungen\Autodesk\AutoCAD\Energie_Infrastruktur\Templates" /qb-!"
Bitte um Hilfe!

Code: Alles auswählen

   opsi-client-agent         4.0.2.1-1                 opsi.org client agent
   opsi-winst                4.11.2.9-1                winst
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: WinBatch: Nicht alle Variablen werden richtig eingesetzt

Beitrag von r.roeder »

seteqsystems hat geschrieben:
wie es sein kann, dass in einer Winbatch-Sektion nur gewisse Variablen eingesetzt werden?
Einfach, weil im Code

Code: Alles auswählen

	Set $InstCmd$='msiexec [...] ACADDEFAULTPROFILENAME="$Location$ - $Profile$" [...]'
$Location$ etc. gar nicht als Variable verwendet wird, sondern als Zeichenfolge, die Teil eines längeren Strings ist (beachte Unterschiede der syntaktischen Verwendung von "Variablen" in primären und sekundären Sektionen.
Zum gewünschten Ergebnis sollte führen

Code: Alles auswählen

	Set $InstCmd$='msiexec [...] ACADDEFAULTPROFILENAME="' + $Location$ + '" - "' + $Profile$ + '" [...]'
Grüße
Rupert Röder


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


seteqsystems
Beiträge: 62
Registriert: 12 Sep 2012, 11:51
Wohnort: Hall in Tirol

Re: WinBatch: Nicht alle Variablen werden richtig eingesetzt

Beitrag von seteqsystems »

Danke für den Tipp, ich werde das gleich nochmal testen!

Es ist aber trotzdem komisch warum das mit der Variable $BasePath$ schon problemlos klappt...
Antworten