VirtualBox

source: vbox/trunk/src/VBox/Main/src-all/win/comregister.cmd@ 39262

Last change on this file since 39262 was 39262, checked in by vboxsync, 13 years ago

comregister.cmd: Try make sure the right stuff is registered and that the PATH does not interfer.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette