[
  {
    "path": "Google Drive.bat",
    "content": "@ECHO OFF\n\n::Checking for administrator rights using fsutil which will only work iff under admin rights\n::which just queries the volume here %systemdrive% for a 'dirty bit' for corrupted volume \n::WITHOUT TOUCHING ANY FILES/REGISTERY ANYTHING at all\n::source >> https://stackoverflow.com/a/21295806\n\n::Using an elevated runas cmd prompt/powershell is deliberately avoided for security/privacy reasons\n::and to have a SYSTEM-LESS way\n\nfsutil dirty query %systemdrive% >nul\nIF %ERRORLEVEL% GTR 0 goto NO_ADMIN_ERROR\n\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /ve /t REG_SZ /d \"Google Drive\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /v \"System.IsPinnedToNamespaceTree\" /t REG_DWORD /d \"1\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /v \"SortOrderIndex\" /t REG_DWORD /d \"66\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\InProcServer32\" /ve /t REG_EXPAND_SZ /d \"%SYSTEMROOT%\\system32\\shell32.dll\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\ShellFolder\" /v \"FolderValueFlags\" /t REG_DWORD /d \"40\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\ShellFolder\" /v \"Attributes\" /t REG_DWORD /d \"4034920525\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /ve /t REG_SZ /d \"Google Drive\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /v \"System.IsPinnedToNamespaceTree\" /t REG_DWORD /d \"1\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /v \"SortOrderIndex\" /t REG_DWORD /d \"66\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\InProcServer32\" /ve /t REG_EXPAND_SZ /d \"%SYSTEMROOT%\\system32\\shell32.dll\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\ShellFolder\" /v \"FolderValueFlags\" /t REG_DWORD /d \"40\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\ShellFolder\" /v \"Attributes\" /t REG_DWORD /d \"4034920525\" /f\nREG 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\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\" /v \"CLSID\" /t REG_SZ /d \"{0E5AAE11-A475-4c5b-AB00-C66DE400274E}\" /f\nREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"Attributes\" /t REG_DWORD /d \"17\" /f\nREG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel\" /v \"{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /t REG_DWORD /d \"1\" /f\nREG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /ve /t REG_SZ /d \"Google Drive\" /f\nREG 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\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\" /v \"CLSID\" /t REG_SZ /d \"{0E5AAE11-A475-4c5b-AB00-C66DE400274E}\" /f\nREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"Attributes\" /t REG_DWORD /d \"17\" /f\n\nIF EXIST \"%USERPROFILE%\\\\My Drive\" (\n\tREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"TargetFolderPath\" /t REG_EXPAND_SZ /d \"%USERPROFILE%\\My Drive\" /f\n\tREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"TargetFolderPath\" /t REG_EXPAND_SZ /d \"%USERPROFILE%\\My Drive\" /f\n) ELSE (\n\tREG ADD \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"TargetFolderPath\" /t REG_SZ /d \"G:\\\\\" /f\n\tREG ADD \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\\Instance\\InitPropertyBag\" /v \"TargetFolderPath\" /t REG_SZ /d \"G:\\\\\" /f\n)\n\npause\ngoto :EOF\n\n:NO_ADMIN_ERROR\n\n::The error msg is here just for reference, you are free and encouraged to add your own\n\necho =====================================================\necho This script needs to be executed as an administrator.\necho =====================================================\necho .\npause\ngoto :EOF"
  },
  {
    "path": "README.md",
    "content": "# Google Drive in Windows Explorer\n\nOneDrive 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/)\n\n**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.**\n\n## Installation\n\n1. 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).\n2. Restart your computer.\n\n## Results\nYou should now see Google Drive pinned to the Windows Explorer sidebar.\n\n![before](https://user-images.githubusercontent.com/92355621/137851324-059e4c12-ad0c-4fe3-afb6-e166a96d3fdb.png)\n![after](https://user-images.githubusercontent.com/92355621/137851316-7c748dfe-b91d-4dc0-8883-31983a3e8d2b.png)\n\n## Uninstallation\n\n1. Download and run the **`Remove Google Drive.bat`** batch file as an Administrator.\n2. Restart your computer. \n\n## Custom Folder Location\nIf 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`.\n"
  },
  {
    "path": "Remove Google Drive.bat",
    "content": "@ECHO OFF\n\n::Checking for administrator rights using fsutil which will only work iff under admin rights\n::which just queries the volume here %systemdrive% for a 'dirty bit' for corrupted volume \n::WITHOUT TOUCHING ANY FILES/REGISTERY ANYTHING at all\n::source >> https://stackoverflow.com/a/21295806\n\n::Using an elevated runas cmd prompt/powershell is deliberately avoided for security/privacy reasons\n::and to have a SYSTEM-LESS way\n\nfsutil dirty query %systemdrive% >nul\nIF %ERRORLEVEL% GTR 0 goto NO_ADMIN_ERROR\n\nREG DELETE \"HKCU\\Software\\Classes\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /f\nREG DELETE \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /f\nREG DELETE \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /f\nREG DELETE \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel\" /v \"{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}\" /f\nREG ADD \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel\" /f\n\npause\ngoto :EOF\n\n:NO_ADMIN_ERROR\n\n::The error msg is here just for reference, you are free and encouraged to add your own\n\necho =====================================================\necho This script needs to be executed as an administrator.\necho =====================================================\necho .\npause\ngoto :EOF"
  }
]