コメント |
@DIV
USB のリムーバルドライブ内の @C:red(SERVICE\MySQL5126) に
インストール済みセットが入っているとします。
以下のスクリプトを リムーバルドライブ内の好きな場所に置いて、
エクスプローラから実行します
( ここでの前提条件は、 @C:red(U ドライブが使用されていない事です) )
@END
[[INSTALL.vbs]]
@DIV
Set WshShell = CreateObject( "WScript.Shell" )
str = WshShell.CurrentDirectory
strDrive = Left( str, 2 )
Call WshShell.Run( "subst U: " & strDrive & "\SERVICE", 0, True )
str = """U:\mysql5126\bin\mysqld.exe"" --install-manual MySQL5126 --defaults-file=""U:\mysql5126\my.ini"""
Call WshShell.Run( str, 0, True )
' **********************************************************
' サービス( MySQL5126 )
' **********************************************************
Set objWMIService = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colRunningServices = _
objWMIService.ExecQuery("Select * from Win32_Service Where DisplayName = 'MySQL5126'")
For Each objService in colRunningServices
if objService.State = "Stopped" then
objService.StartService()
end if
Next
@END
[[以下は、サービスと実行環境のアンインストールです]]
@DIV
Set WshShell = CreateObject( "WScript.Shell" )
' **********************************************************
' サービス( MySQL5126 )
' **********************************************************
Set objWMIService = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colRunningServices = _
objWMIService.ExecQuery("Select * from Win32_Service Where DisplayName = 'MySQL5126'")
For Each objService in colRunningServices
if objService.State = "Running" then
objService.StopService()
end if
Next
str = """U:\mysql5126\bin\mysqld.exe"" --remove MySQL5126"
Call WshShell.Run( str, 0, True )
Call WshShell.Run( "subst U: /D", 0, True )
@END
|