Hi Panzo. This is an interesting problem!
Let’s start by outlining the issue.
Why Google Drive Auto-Updates cause trouble for AlwaysUp
Curiously, Google Drive for desktop installs itself to a path that includes the version number of the software.
For example, when we installed Drive for desktop version 22.214.171.124, the executable files were placed in:
C:\Program Files\Google\Drive File Stream\126.96.36.199
You can see the arrangement here:
While this is fine for Google Drive, it can lead to problems for AlwaysUp. Let’s explain with a real-life scenario:
You install Google Drive for desktop version 188.8.131.52, as pictured above.
Following our tutorial, you configure Google Drive File Stream to run as a service with AlwaysUp. In doing so, you provide the full path to the Google Drive executable to AlwaysUp:
C:\Program Files\Google\Drive File Stream\184.108.40.206\GoogleDriveFS.exe
You can see the path here in the “Application” field:
AlwaysUp starts Google Drive at boot and everything runs as expected. You celebrate with some chocolate and move on to one of life’s more pressing problems.
A few weeks later, the Google Drive team issues an update. A new version 220.127.116.11 is available. Eventually, your Google Drive installation “phones home” and automatically updates itself.
As part of that update process, Google Drive:
Creates a folder to house the new version:
C:\Program Files\Google\Drive File Stream\18.104.22.168
Deposits the version 22.214.171.124 files into the new folder.
You will now have two folders containing Google Drive executables:
This is completely fine as far as Google Drive is concerned. However, AlwaysUp still points to the executable in the folder containing the old version. Therefore, whenever your computer reboots, AlwaysUp will launch the outdated version of Google Drive (126.96.36.199). And therein lies the problem.
How to ensure that AlwaysUp launches the latest version of Google Drive for desktop
It turns out that Google has provided an elegant solution that AlwaysUp can leverage too.
The solution starts to take shape when you examine the details of the desktop shortcut that launches Google Drive. Instead of directly targeting the “GoogleDriveFS.exe” binary as we expected, the shortcut runs this batch file in the top-level folder:
C:\Program Files\Google\Drive File Stream\launch.bat
You can see this in the shortcut’s properties:
When we opened the launch.bat file, the comments at the top made us smile:
Indeed, the code finds and starts the latest version of GoogleDriveFS.exe, interrogating the registry and enumerating sub-folders as necessary. It’s exactly what we were looking for.
So with this script in hand, the solution is simple:
You will make that change in the “Application” field:
And with that change in place, the next time your computer boots:
AlwaysUp will run “launch.bat”
The batch file will start the latest version of Google Drive and exit
AlwaysUp will continue to watch Google Drive and restart it if it fails, etc.
In fact, the sequence played out exactly as expected on our test server:
You will be good to go — no matter how many updates the folks at Google throw at you! 😎