1

当框架已经安装时,如何让这个脚本进入 INSTALLAX?即使框架已经存在,它也会安装框架。

我错过了什么?

Echo off
IF EXIST "%Programfiles(x86)%" (GOTO 64-Bit) ELSE (GOTO 32-Bit)

:32-Bit
IF EXIST "%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe" GOTO INSTALLAX ELSE GOTO INSTALLFRAMEWORK

:64-Bit
IF EXIST "%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe" GOTO INSTALLAX ELSE GOTO INSTALLFRAMEWORK

:INSTALLFRAMEWORK
start "" /w "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Prerequisites\Net Framework 4.0\dotNetFx40_Full_x86_x64.exe" /q /norestart
ECHO .NETFramework4.0Installed %Date% %TIME% >> \\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log\Framework\%COMPUTERNAME%.log

:INSTALLAX
start "" /w "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\DynamicsAX\setup.exe" RunMode=Custom HideUI=1 AcceptLicenseTerms=1 ByPasswarnings=0 InstallClientUI=1 ClientAOSServer=ax-aos02-prod AOSPort=2712 AOSWsdlPort=8101 ClientLanguage=en-us ConfigurePrerequisites=1 ClientConfigFile="\\sespfs01\appdata01\Deployment\MicrosoftDynamicsAX\AX_Icons\DAX_Prod(usr)32-bit.axc" LogDir="\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log"
ECHO AXDynamics2012Installed %Date% %TIME% >> \\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log\AXDynamics\%COMPUTERNAME%.log" GOTO END

:END
Exit
4

2 回答 2

2

你的问题很明显:

IF EXIST "%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe" GOTO INSTALLAX GOTO INSTALLFRAMEWORK

条件中没有ELSE

而在 subs ": INSTALLFRAMEWORK " 和 ": INSTALLAX " 中,您不会告诉退出程序,所以 ": INSTALLAX " 总是被处理。

同样在“:INSTALLAX ”过程中,您使用两个命令而不使用连接运算符“ & ”(Echo blabla >> file goto blabla

这是代码:

@Echo off

Set "FW32=%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe"
Set "FW64=%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe"

IF EXIST "%Programfiles(x86)%" (
    REM 64BIT
    IF EXIST "%FW64%" (GOTO :INSTALLAX) ELSE (GOTO :INSTALLFRAMEWORK)
) ELSE (
    REM 32BIT
    IF EXIST "%FW32%" (GOTO :INSTALLAX) ELSE (GOTO :INSTALLFRAMEWORK)
)

:INSTALLFRAMEWORK
start "" /Wait "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Prerequisites\Net Framework 4.0\dotNetFx40_Full_x86_x64.exe" /q /norestart
ECHO .NETFramework4.0Installed %Date% %TIME% >> "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log\Framework\%COMPUTERNAME%.log"
Pause&Exit

:INSTALLAX
start "" /Wait "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\DynamicsAX\setup.exe" RunMode=Custom HideUI=1 AcceptLicenseTerms=1 ByPasswarnings=0 InstallClientUI=1 ClientAOSServer=ax-aos02-prod AOSPort=2712 AOSWsdlPort=8101 ClientLanguage=en-us ConfigurePrerequisites=1 ClientConfigFile="\\sespfs01\appdata01\Deployment\MicrosoftDynamicsAX\AX_Icons\DAX_Prod(usr)32-bit.axc" LogDir="\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log"
ECHO AXDynamics2012Installed %Date% %TIME% >> "\\server1\appdata01\Deployment\MicrosoftDynamicsAX\Client_Log\AXDynamics\%COMPUTERNAME%.log"
Pause&Exit
于 2013-04-23T11:27:01.953 回答
0

您已经在第一个 IF 语句中做对了(使用括号)。

:32-Bit
IF EXIST "%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe"
  (GOTO INSTALLAX) ELSE (GOTO INSTALLFRAMEWORK)

:64-Bit
IF EXIST "%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe"
  (GOTO INSTALLAX) ELSE (GOTO INSTALLFRAMEWORK)

(仅为可读性添加换行符)

另外,你错过了一个 ELSE。

于 2013-04-23T11:25:43.730 回答