1 | @echo off
|
---|
2 | REM $Id: comregister.cmd 39262 2011-11-10 12:18:16Z vboxsync $
|
---|
3 | REM
|
---|
4 | REM Script to register the VirtualBox COM classes
|
---|
5 | REM (both inproc and out-of-process)
|
---|
6 | REM
|
---|
7 |
|
---|
8 | REM
|
---|
9 | REM Copyright (C) 2006-2011 Oracle Corporation
|
---|
10 | REM
|
---|
11 | REM This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | REM available from http://www.virtualbox.org. This file is free software;
|
---|
13 | REM you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | REM General Public License (GPL) as published by the Free Software
|
---|
15 | REM Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | REM VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | REM hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | REM
|
---|
19 |
|
---|
20 | setlocal
|
---|
21 |
|
---|
22 | REM
|
---|
23 | REM Figure out where the script lives first, so that we can invoke the
|
---|
24 | REM correct VBoxSVC and register the right VBoxC.dll.
|
---|
25 | REM
|
---|
26 |
|
---|
27 | REM Determin the current directory.
|
---|
28 | set _SCRIPT_CURDIR=%CD%
|
---|
29 | for /f "tokens=*" %%d in ('cd') do set _SCRIPT_CURDIR=%%d
|
---|
30 |
|
---|
31 | REM Determin a correct self - by %0.
|
---|
32 | set _SCRIPT_SELF=%0
|
---|
33 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
34 | set _SCRIPT_SELF=%_SCRIPT_SELF%.cmd
|
---|
35 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
36 |
|
---|
37 | REM Determin a correct self - by current working directory.
|
---|
38 | set _SCRIPT_SELF=%_SCRIPT_CURDIR%\comregister.cmd
|
---|
39 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
40 |
|
---|
41 | REM Determin a correct self - by the PATH
|
---|
42 | REM This is very verbose because nested for loops didn't work out.
|
---|
43 | for /f "tokens=1 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
44 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
45 | for /f "tokens=2 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
46 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
47 | for /f "tokens=3 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
48 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
49 | for /f "tokens=4 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
50 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
51 | for /f "tokens=5 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
52 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
53 | for /f "tokens=6 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
54 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
55 | for /f "tokens=7 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
56 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
57 | for /f "tokens=8 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
58 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
59 | for /f "tokens=9 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
60 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
61 | for /f "tokens=10 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
62 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
63 | for /f "tokens=11 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
64 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
65 | for /f "tokens=12 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
66 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
67 | for /f "tokens=13 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
68 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
69 | for /f "tokens=14 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
70 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
71 | for /f "tokens=15 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
72 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
73 | for /f "tokens=16 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
74 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
75 | for /f "tokens=17 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
76 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
77 | for /f "tokens=18 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
78 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
79 | for /f "tokens=19 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
80 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
81 | for /f "tokens=20 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
|
---|
82 | if exist "%_SCRIPT_SELF%" goto found_self
|
---|
83 | echo Warning: Not able to determin the comregister.cmd location.
|
---|
84 | set _VBOX_DIR=
|
---|
85 | goto register
|
---|
86 |
|
---|
87 | :found_self
|
---|
88 | set _VBOX_DIR=
|
---|
89 | cd "%_SCRIPT_SELF%\.."
|
---|
90 | for /f "tokens=*" %%d in ('cd') do set _VBOX_DIR=%%d\
|
---|
91 | cd "%_SCRIPT_CURDIR%"
|
---|
92 |
|
---|
93 |
|
---|
94 | REM
|
---|
95 | REM Do the registrations.
|
---|
96 | REM
|
---|
97 | :register
|
---|
98 | @echo on
|
---|
99 | %_VBOX_DIR%VBoxSVC.exe /ReregServer
|
---|
100 | regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
|
---|
101 | regsvr32 /s %_VBOX_DIR%VBoxC.dll
|
---|
102 | @echo off
|
---|
103 |
|
---|
104 | :end
|
---|
105 | endlocal
|
---|
106 |
|
---|