VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/win/load.cmd@ 82928

Last change on this file since 82928 was 79406, checked in by vboxsync, 6 years ago

HostDrivers/win/load.cmd: Put drivers in a different place when loading them so the build doesn't fail on windows 10 because the .sys file is kept open. Rewrote bourne shell stuff as CMD mess.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1@echo off
2rem $Id: load.cmd 79406 2019-06-28 10:43:24Z vboxsync $
3rem rem @file
4rem Windows NT batch script for loading the support driver.
5rem
6
7rem
8rem Copyright (C) 2009-2019 Oracle Corporation
9rem
10rem This file is part of VirtualBox Open Source Edition (OSE), as
11rem available from http://www.virtualbox.org. This file is free software;
12rem you can redistribute it and/or modify it under the terms of the GNU
13rem General Public License (GPL) as published by the Free Software
14rem Foundation, in version 2 as it comes in the "COPYING" file of the
15rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17rem
18rem The contents of this file may alternatively be used under the terms
19rem of the Common Development and Distribution License Version 1.0
20rem (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21rem VirtualBox OSE distribution, in which case the provisions of the
22rem CDDL are applicable instead of those of the GPL.
23rem
24rem You may elect to license modified versions of this file under the
25rem terms and conditions of either the GPL or the CDDL or both.
26rem
27
28
29setlocal ENABLEEXTENSIONS
30setlocal ENABLEDELAYEDEXPANSION
31setlocal
32
33
34rem
35rem find the directory we're in.
36rem
37set MY_DIR=%~dp0
38if exist "%MY_DIR%\load.cmd" goto dir_okay
39echo load.cmd: failed to find load.sh in "%~dp0".
40goto end
41
42:dir_okay
43rem
44rem We don't use the driver files directly any more because of win10 keeping the open,
45rem so create an alternative directory for the binaries.
46rem
47set MY_ALTDIR=%MY_DIR%\..\LoadedDrivers
48if not exist "%MY_ALTDIR%" mkdir "%MY_ALTDIR%"
49
50rem
51rem Display device states.
52rem
53for %%i in (VBoxNetAdp VBoxNetAdp6 VBoxNetFlt VBoxNetLwf VBoxUSBMon VBoxUSB VBoxDrv) do (
54 set type=
55 for /f "usebackq tokens=*" %%f in (`sc query %%i`) do (set xxx=%%f&&if "!xxx:~0,5!" =="STATE" set type=!xxx!)
56 for /f "usebackq tokens=2 delims=:" %%f in ('!type!') do set type=%%f
57 if "!type!x" == "x" set type= not configured, probably
58 echo load.sh: %%i -!type!
59)
60
61rem
62rem Copy uninstallers and installers and VBoxRT into the dir:
63rem
64echo **
65echo ** Copying installers and uninstallers into %MY_ALTDIR%...
66echo **
67set MY_FAILED=no
68for %%i in (NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe ^
69 NetAdpInstall.exe NetAdp6Install.exe USBInstall.exe NetFltInstall.exe NetLwfInstall.exe SUPInstall.exe ^
70 VBoxRT.dll) do if exist "%MY_DIR%\%%i" (copy "%MY_DIR%\%%i" "%MY_ALTDIR%\%%i" || set MY_FAILED=yes)
71if "%MY_FAILED%" == "yes" goto end
72
73rem
74rem Unload the drivers.
75rem
76echo **
77echo ** Unloading drivers...
78echo **
79for %%i in (NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe) do (
80 if exist "%MY_ALTDIR%\%%i" (echo ** Running %%i...&& "%MY_ALTDIR%\%%i")
81)
82
83rem
84rem Copy the driver files into the directory now that they no longer should be in use and can be overwritten.
85rem
86echo **
87echo ** Copying drivers into %MY_ALTDIR%...
88echo **
89set MY_FAILED=no
90for %%i in (VBoxDrv.sys VBoxDrv.inf VBoxDrv.cat) do if exist "%MY_DIR%\%%i" (copy "%MY_DIR%\%%i" "%MY_ALTDIR%\%%i" || set MY_FAILED=yes)
91if "%MY_FAILED%" == "yes" goto end
92
93rem
94rem Invoke the installer if asked to do so.
95rem
96if "%1%" == "-u" goto end
97if "%1%" == "--uninstall" goto end
98echo **
99echo ** Loading drivers...
100echo **
101for %%i in (SUPInstall.exe) do "%MY_ALTDIR%\%%i" || goto end
102
103:end
104endlocal
105endlocal
106endlocal
107
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