Repository: svenkle/google-drive-add-to-explorer Branch: master Commit: 5a5211f66033 Files: 3 Total size: 7.6 KB Directory structure: gitextract_2qy9jens/ ├── Google Drive.bat ├── README.md └── Remove Google Drive.bat ================================================ FILE CONTENTS ================================================ ================================================ FILE: Google Drive.bat ================================================ @ECHO OFF ::Checking for administrator rights using fsutil which will only work iff under admin rights ::which just queries the volume here %systemdrive% for a 'dirty bit' for corrupted volume ::WITHOUT TOUCHING ANY FILES/REGISTERY ANYTHING at all ::source >> https://stackoverflow.com/a/21295806 ::Using an elevated runas cmd prompt/powershell is deliberately avoided for security/privacy reasons ::and to have a SYSTEM-LESS way fsutil dirty query %systemdrive% >nul IF %ERRORLEVEL% GTR 0 goto NO_ADMIN_ERROR REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /ve /t REG_SZ /d "Google Drive" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /v "System.IsPinnedToNamespaceTree" /t REG_DWORD /d "1" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /v "SortOrderIndex" /t REG_DWORD /d "66" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\InProcServer32" /ve /t REG_EXPAND_SZ /d "%SYSTEMROOT%\system32\shell32.dll" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\ShellFolder" /v "FolderValueFlags" /t REG_DWORD /d "40" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\ShellFolder" /v "Attributes" /t REG_DWORD /d "4034920525" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /ve /t REG_SZ /d "Google Drive" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /v "System.IsPinnedToNamespaceTree" /t REG_DWORD /d "1" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /v "SortOrderIndex" /t REG_DWORD /d "66" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\InProcServer32" /ve /t REG_EXPAND_SZ /d "%SYSTEMROOT%\system32\shell32.dll" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\ShellFolder" /v "FolderValueFlags" /t REG_DWORD /d "40" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\ShellFolder" /v "Attributes" /t REG_DWORD /d "4034920525" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\DefaultIcon" /ve /t REG_EXPAND_SZ /d "%PROGRAMFILES%\Google\Drive File Stream\drive_fs.ico,0" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance" /v "CLSID" /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "Attributes" /t REG_DWORD /d "17" /f REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /t REG_DWORD /d "1" /f REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /ve /t REG_SZ /d "Google Drive" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\DefaultIcon" /ve /t REG_EXPAND_SZ /d "%PROGRAMFILES%\Google\Drive File Stream\drive_fs.ico,0" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance" /v "CLSID" /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" /f REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "Attributes" /t REG_DWORD /d "17" /f IF EXIST "%USERPROFILE%\\My Drive" ( REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "TargetFolderPath" /t REG_EXPAND_SZ /d "%USERPROFILE%\My Drive" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "TargetFolderPath" /t REG_EXPAND_SZ /d "%USERPROFILE%\My Drive" /f ) ELSE ( REG ADD "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "TargetFolderPath" /t REG_SZ /d "G:\\" /f REG ADD "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\Instance\InitPropertyBag" /v "TargetFolderPath" /t REG_SZ /d "G:\\" /f ) pause goto :EOF :NO_ADMIN_ERROR ::The error msg is here just for reference, you are free and encouraged to add your own echo ===================================================== echo This script needs to be executed as an administrator. echo ===================================================== echo . pause goto :EOF ================================================ FILE: README.md ================================================ # Google Drive in Windows Explorer OneDrive and Dropbox both create non-removable shortcuts in the Windows Explorer sidebar - the same unfortunately cannot be said for Google Drive. The scripts in this repository will make the necessary changes to allow for a Google Drive shortcut in Windows Explorer. The original article can be found at [Adding Google Drive to the Windows Explorer sidebar](https://luke.digital/adding-google-drive-to-the-explorer-sidebar/) **Disclaimer: This was tested on Windows 2019 Server, Windows 10 Professional and Windows 8.1 Professional. Ensure you backup your registry before making any changes.** ## Installation 1. Download and run the **`Google Drive.bat`** batch file as an Administrator. Instructions for how to run a batch file as Administrator can be found [here](https://www.wikihow.com/Run-a-BAT-File-on-Windows), [here](https://www.windowscentral.com/how-create-and-run-batch-file-windows-10) or [here](https://www.letmegooglethat.com/?q=how+to+run+a+batch+file). 2. Restart your computer. ## Results You should now see Google Drive pinned to the Windows Explorer sidebar. ![before](https://user-images.githubusercontent.com/92355621/137851324-059e4c12-ad0c-4fe3-afb6-e166a96d3fdb.png) ![after](https://user-images.githubusercontent.com/92355621/137851316-7c748dfe-b91d-4dc0-8883-31983a3e8d2b.png) ## Uninstallation 1. Download and run the **`Remove Google Drive.bat`** batch file as an Administrator. 2. Restart your computer. ## Custom Folder Location If Google Drive is configured in mirror or classic mode and not installed in the default location i.e `C:\Users\Username\My Drive` you must update lines #26 and #27 to reflect the correct location before running the script. For example, if Google Drive is configured for `C:\Google Drive` you must update the value from `%USERPROFILE%\My Drive` to `C:\Google Drive`. ================================================ FILE: Remove Google Drive.bat ================================================ @ECHO OFF ::Checking for administrator rights using fsutil which will only work iff under admin rights ::which just queries the volume here %systemdrive% for a 'dirty bit' for corrupted volume ::WITHOUT TOUCHING ANY FILES/REGISTERY ANYTHING at all ::source >> https://stackoverflow.com/a/21295806 ::Using an elevated runas cmd prompt/powershell is deliberately avoided for security/privacy reasons ::and to have a SYSTEM-LESS way fsutil dirty query %systemdrive% >nul IF %ERRORLEVEL% GTR 0 goto NO_ADMIN_ERROR REG DELETE "HKCU\Software\Classes\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /f REG DELETE "HKCU\Software\Classes\Wow6432Node\CLSID\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /f REG DELETE "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /f REG DELETE "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" /f REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /f pause goto :EOF :NO_ADMIN_ERROR ::The error msg is here just for reference, you are free and encouraged to add your own echo ===================================================== echo This script needs to be executed as an administrator. echo ===================================================== echo . pause goto :EOF