(the new) google drive

Oct 18, 2008
345
2
Hello --- google's (consumer) cloud space, formerly known as "backup and sync" has been update and is now call just "google drive" the new google code changes the model that dropbox used (the default behavior) of mirroring the local file tree with the files in the cloud now with a "virtual drive" and caches files as they are used.

the folks over at google wrote a (clever?) bat file. launch.bat. that locates the "current version" of the code and then execute's that *.exe file

as it turns out, the bat file works fine when executed with cmd.exe, but fails with tcc.exe --- is there any way to debug this

any suggestions appreciated
 
Oct 18, 2008
345
2
it seems that I am having an issue attaching a file --- I will put a link to it in the cloud
 

samintz

Scott Mintz
May 20, 2008
1,534
22
Solon, OH, USA
This is the script file:
Code:
@echo off

rem Launcher script for GoogleDriveFS.exe that looks up the latest
rem GoogleDriveFS.exe and runs it with the same arguments as the script.
rem Convenient to use as a target for Windows shortcuts.

rem Use '!' instead of '%' for variable names.
setlocal EnableDelayedExpansion

rem
rem First try looking in the registry.
rem
set COMMAND="reg.exe query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{6BBAE539-2232-434A-A4E5-9A33560C6283}  /v InstallLocation"
rem Get the 3rd and following tokens of the 2nd line separated by space.
for /f "skip=1 tokens=3,* usebackq" %%A in (`!COMMAND!`) do (
  set EXE_PATH=%%A %%B %%C %%D %%E %%F %%G %%H %%I %%J %%K %%L %%M %%N
)
rem Sadly we get back the unused %%variables at the end of the string.
rem Strip /%.+/ from the end.
for /f "tokens=1 usebackq delims=%%" %%A in ('!EXE_PATH!') do (
  set EXE_PATH=%%A
)

if exist "!EXE_PATH!" (goto :RUN_IT)

rem
rem If we fail, look in the current directory.
rem
set DRIVE_FS_DIR=%~dp0

rem Sort DRIVE_FS_DIR's subdirectories (/a:d) by reverse date (/o:-d) of
rem creation (/t:c) and find the first one that contains the exe.
for /f "usebackq" %%A in  (`dir "%%DRIVE_FS_DIR%%\*" /a:d /o:-d /t:c /b`) do (
  set EXE_PATH=!DRIVE_FS_DIR!\%%A\GoogleDriveFS.exe
  if exist "!EXE_PATH!" (goto :RUN_IT)
)

:FAIL
@echo Fatal error: Can't find DriveFS path. Please reinstall Drive for Desktop.
pause
exit /b 1

:RUN_IT
@echo Found path: !EXE_PATH!
start "Launch Google Drive" "!EXE_PATH!" %*
exit /b 0

I have never seen delayed variable expansion used outside of a FOR statement.
 

samintz

Scott Mintz
May 20, 2008
1,534
22
Solon, OH, USA
Nothing stands out to me as to why it's not working for you. DelayedExpansion works for me in TCC. Perhaps you need to enable it in your TCC configuration by checking the "CMD.EXE delayed expansion (!var!)" option in the TCC OPTION dialog.
 
May 20, 2008
11,867
121
Syracuse, NY, USA
That's a pretty amazing batch file ... 46 lines of hardly human-readable (this human anyway) stuff just to do this.

Code:
v:\> echo The EXE is %@word[4-,%@execstr[regdir /v /d HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6BBAE539-2232-434A-A4E5-9A33560C6283} | findstr /i /r "installlocation.*googledrivefs.exe"]]

The EXE is C:\Program Files\Google\Drive File Stream\51.0.14.0\GoogleDriveFS.exe

Thanks, Rex!
 
May 20, 2008
11,867
121
Syracuse, NY, USA
And note, uninstalling GoogleDrive does not uninstall, or even reconfigure these.

1632365069025.png
 
May 20, 2008
11,867
121
Syracuse, NY, USA
I believe those are used for pretty much any Google program that's installed. In my case it's Chrome. I've never had Drive installed.
Yeah, I figured that. I'd hate to see a batch file to determine what Google programs are installed.
 
Jun 2, 2008
364
4
I figured the update service would reference a list somewhere, so I went looking and found HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Update\Clients. Mine has 5 entries; the 4 Google programs I have installed, plus the updater itself.
 

Similar threads