我正在尝试创建一个同时安装SQL Server的.msi安装程序(如果用户有磁盘/ iso文件)。
它应该如何运作:
这些论点似乎与我运行它的方式完全相同。
@echo off
::this file searches for the setup.exe and then installs the server.
::ARGUMENTS:Complete Path to the Configuration File
::ATTENTION: this will need to search for a more unique file in the future!
::loop through each letter for a drive
for %%A in (D E F G H I J K L M N O P Q R S T U V W X Y Z) Do (
::check if file exists, send any error messages to NUL, destroying it(e.g. no disk in drive) and installif found
DIR "%%A:/setup.exe" 1>NUL 2>&1 && call:install %%A %1 %2
::if we reach here the file ahsn't been found
if %%A == Z (
@echo Please insert the Microsoft SQL Server 2008 R2 disk and try again.
pause
exit
)
)
:install
net user grp-db ..grp.. /add
echo Installing SQL Server 2008 R2 with %~2
date/t
time /t
::"%~1:\setup.exe" /ConfigurationFile="%~2"
DIR "%~2"
date/t
time /t
pause
echo Creating ODBC data source.. with %~3
::"%~3"ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=GRP_DSN | Description=GRP Data Source | SERVER=(local) | Trusted_Connection=Yes"
exit
goto:eof
从命令提示符运行批处理文件完全按预期工作,但在msi中它会导致StackOverflowException。检查SQL目录中的摘要文件说
用户取消了操作。异常类型:Microsoft.SqlServer.Chainer.Infrastructure.CancelException。
有没有人有任何想法从哪开始?
答案 0 :(得分:0)
看起来SQL Server安装和MSI进程之间存在冲突。
您可以尝试将其添加为MSI的先决条件,而不是使用BAT来安装SQL Server: