-
-
Save Hotrian/9afb835542b19af7b49782d578892e8b to your computer and use it in GitHub Desktop.
@echo off | |
goto prep | |
REM This batch script removes the leap drivers temporarily so SteamVR won't attempt to launch them | |
REM It also backup/restores the SteamVR.vrsettings file so you can have two copies and it switches the correct version in | |
REM This is just a little batch program I wrote to quickly disable/enable the SteamVR Leap Motion Drivers | |
REM You should copy steamvr.vrsettings twice and rename one to LeapVRSettings.vrsettings and the other to RegularVRSettings.vrsettings | |
REM Then run this batch once or twice and then go back in and change your steamvr.vrsettings as needed | |
:prep | |
set leapfolder="C:\Program Files\SteamVR Leap Motion driver\" | |
set steamfolder="C:\Program Files (x86)\Steam\" | |
echo Leap Folder: %leapfolder% | |
echo Steam Folder: %steamfolder% | |
IF NOT EXIST %leapfolder%\removed\ call :createremovedfolder | |
goto start | |
:createremovedfolder | |
echo "Removed" folder not found, attempting to create.. | |
mkdir %leapfolder%\removed | |
IF NOT EXIST %leapfolder%\removed\ echo "Unable to create folder. Try launching as admin." | |
goto start | |
:start | |
IF NOT EXIST %leapfolder%\removed\ goto eof | |
IF EXIST %leapfolder%\leap.vrsettings goto swap1 | |
IF EXIST %leapfolder%\removed\leap.vrsettings goto swap2 | |
goto notfound | |
:swap1 | |
echo Disable Leap Motion Drivers | |
move %leapfolder%\leap %leapfolder%\removed\ | |
move %leapfolder%\config_tool.exe %leapfolder%\removed\ | |
move %leapfolder%\leap.vrsettings %leapfolder%\removed\ | |
move %leapfolder%\leap_backup.vrsettings %leapfolder%\removed\ | |
echo Backup SteamVR Settings to LeapVRSettings.vrsettings | |
del %steamfolder%\config\LeapVRSettings.vrsettings | |
copy %steamfolder%\config\steamvr.vrsettings %steamfolder%\config\LeapVRSettings.vrsettings | |
echo Restore SteamVR Settings from RegularVRSettings.vrsettings | |
del %steamfolder%\config\steamvr.vrsettings | |
copy %steamfolder%\config\RegularVRSettings.vrsettings %steamfolder%\config\steamvr.vrsettings | |
echo Done | |
goto eof | |
:swap2 | |
echo Enable Leap Motion Drivers | |
move %leapfolder%\removed\leap %leapfolder%\ | |
move %leapfolder%\removed\config_tool.exe %leapfolder%\ | |
move %leapfolder%\removed\leap.vrsettings %leapfolder%\ | |
move %leapfolder%\removed\leap_backup.vrsettings %leapfolder%\ | |
echo Backup SteamVR Settings to RegularVRSettings.vrsettings | |
del %steamfolder%\config\RegularVRSettings.vrsettings | |
copy %steamfolder%\config\steamvr.vrsettings %steamfolder%\config\RegularVRSettings.vrsettings | |
echo Restore SteamVR Settings from LeapVRSettings.vrsettings | |
del %steamfolder%\config\steamvr.vrsettings | |
copy %steamfolder%\config\LeapVRSettings.vrsettings %steamfolder%\config\steamvr.vrsettings | |
echo Done | |
goto eof | |
:notfound | |
echo Unable to locate SteamVR Leap Motion Drivers | |
goto eof | |
:eof | |
pause |
Basically this batch script just creates a "Removed" folder and moves the drivers back and forth between their normal install location and this folder. If the Leap Motion driver files are in the removed folder, it will move them out and copy LeapVRSettings over the steamvr settings just after backing those settings up to RegularVRSettings. When you run it again, it moves the leap files back into the "removed" folder, and copies the RegularVRSettings over the steamvr settings just after backing them up to LeapVRSettings.
It has to move the files, otherwise the Leap drivers boot up in some way, and cause the VR Server exe to crash when SteamVR closes, even if they aren't activated and being used.
It might require a bit of tweaking to get right for your setup, but this should give everyone a jump start for a quick toggle for the Leap Motion OpenVR Driver.
Check my gist here for the LeapVRSettings file. Copy your steamvr.vrsettings and rename them to LeapVRSettings.vrsettings and add the lines from this gist where they go in it to enable the OpenVR Leap Motion drivers. It's required that you install them so check the GitHub here and get the latest release.