主题:关于用DELPHI对SETUP进行参数设置实现静默安装
以下是本人为实现安装驱动光盘时编的为实现SETUP静默安装的程式,SETUP的静默参数为/s /f2 "c:\setup.log",但不知道要怎么设置这个参数,请高手指点
program Setup;
uses
shellapi,
sysutils,
windows;
var
courrentpath:string;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
PathStr:String;
Function FindDevice(HWID:String):Boolean;stdcall;external 'FindDev.dll';
Function GetSystemStr: WideString;
begin
result:=format('%d.%d' ,[Win32MajorVersion, Win32MinorVersion]);
end;
begin
courrentpath :=ExtractFilePath(Paramstr(0));
SetCurrentDir(courrentpath);
IF FindDevice('PCI\VEN_197B&DEV_0260') THEN //JMC LAN 的硬件ID
Begin
if (GetSystemStr='6.0') or (GetSystemStr='6.1') then //Vista 或Win7系统
PathStr:=courrentpath+'JMC\Setup.exe'
else PathStr:=courrentpath+'JMC\Setup.exe';
end;
ZeroMemory( @si, sizeof(si));
ZeroMemory( @pi, sizeof(pi));
si.cb := sizeof(si);
CreateProcess(pchar(PathStr),PChar('/s'),nil,nil,FALSE,0,nil,pchar(ExtractFilePath(PathStr)),si,pi);
WaitforSingleObject(pi.hProcess,INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end.
program Setup;
uses
shellapi,
sysutils,
windows;
var
courrentpath:string;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
PathStr:String;
Function FindDevice(HWID:String):Boolean;stdcall;external 'FindDev.dll';
Function GetSystemStr: WideString;
begin
result:=format('%d.%d' ,[Win32MajorVersion, Win32MinorVersion]);
end;
begin
courrentpath :=ExtractFilePath(Paramstr(0));
SetCurrentDir(courrentpath);
IF FindDevice('PCI\VEN_197B&DEV_0260') THEN //JMC LAN 的硬件ID
Begin
if (GetSystemStr='6.0') or (GetSystemStr='6.1') then //Vista 或Win7系统
PathStr:=courrentpath+'JMC\Setup.exe'
else PathStr:=courrentpath+'JMC\Setup.exe';
end;
ZeroMemory( @si, sizeof(si));
ZeroMemory( @pi, sizeof(pi));
si.cb := sizeof(si);
CreateProcess(pchar(PathStr),PChar('/s'),nil,nil,FALSE,0,nil,pchar(ExtractFilePath(PathStr)),si,pi);
WaitforSingleObject(pi.hProcess,INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
end.