Created
January 25, 2018 09:34
-
-
Save webgevel/4cf0a3b768f485ce359b24f1b4d498cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
ECHO ---------------------------------------------------------- | |
ECHO Google Drive FS - Silent Change Mountpoint Utility v0.0001 | |
ECHO ---------------------------------------------------------- | |
REM Scripted: Marc Vandael - 25/01/2018 | |
REM Change the var _mountpoint to whatever driveletter you would like. | |
REM If the letter is in use, the next free one will be used. | |
REM This attempts to write to HKLM & HKCU so admin rights are needed for this to work. | |
REM If you run this without admin rights, only the local user is affected. | |
SET _mountpoint= M | |
REM Add the magical REGkey | |
reg add "HKLM\SOFTWARE\Google\DriveFS" /v DefaultMountPoint /t REG_SZ /d %_mountpoint% /f | |
reg add "HKCU\Software\Google\DriveFS" /v DefaultMountPoint /t REG_SZ /d %_mountpoint% /f | |
REM End the DriveFS process | |
taskkill /f /im GoogleDriveFS.exe | |
REM Launch the DriveFS, forcing it to read the new mountpoint from the registry. Since the exe itself is located in a variable | |
REM folder (folder includes version number) I had to use the following... If anyone knows a more elegant approach, contact me. | |
FOR /F "tokens=* USEBACKQ" %%F IN (`where /R "C:\Program Files\Google\Drive File Stream" GoogleDriveFS.exe`) DO ( | |
SET var=%%F | |
) | |
start "" "%var%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment