【发布时间】:2011-11-01 03:03:52
【问题描述】:
我正在尝试创建一个还安装 SQL Server 的 .msi 安装程序(如果用户有磁盘/iso 文件)。
它的工作原理是:
- 它运行一个批处理文件,批处理文件在它所在的驱动器中找到 setup.exe。
- 批处理文件有 2 个参数,配置文件的位置和 msi 的安装目录
- 然后它会搜索 setup.exe 并使用配置文件运行它,执行静默安装。
论据似乎与我运行它的方式完全相同。
@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。
有没有人知道从哪里开始?
【问题讨论】:
标签: visual-studio-2010 sql-server-2008 windows-installer stack-overflow