The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


Q&A: How do I get AlwaysUp to Run the Latest Google Drive for desktop?

Q&A: How do I get AlwaysUp to Run the Latest Google Drive?
  We’re using your AlwaysUp to run Google Drive for desktop even when no one is logged on. But the install folder keeps changing on update (folder name is the current Google Drive version). After an automatic update, AlwaysUp (obviously) still starts the old version of Google Drive. Is there a solution or workaround for this problem?

— Panzo

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 51.0.9.0, the executable files were placed in:

C:\Program Files\Google\Drive File Stream\51.0.9.0

You can see the arrangement here:

Google Drive for desktop installation folder

While this is fine for Google Drive, it can lead to problems for AlwaysUp. Let’s explain with a real-life scenario:

  1. You install Google Drive for desktop version 51.0.9.0, as pictured above.

  2. 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\51.0.9.0\GoogleDriveFS.exe

    You can see the path here in the “Application” field:

    Google Drive application path in AlwaysUp
  3. 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.

  4. A few weeks later, the Google Drive team issues an update. A new version 51.0.14.0 is available. Eventually, your Google Drive installation “phones home” and automatically updates itself.

    As part of that update process, Google Drive:

    1. Creates a folder to house the new version:

      C:\Program Files\Google\Drive File Stream\51.0.14.0

    2. Deposits the version 51.0.14.0 files into the new folder.

      You will now have two folders containing Google Drive executables:

      Google Drive folder after auto-update
  5. 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 (51.0.9.0). 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:

Google Drive desktop shortcut: Properties

When we opened the launch.bat file, the comments at the top made us smile:

Launch.bat file

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:

Instead of having AlwaysUp run “GoogleDriveFS.exe”, configure AlwaysUp to start “launch.bat”.

You will make that change in the “Application” field:

Update AlwaysUp to run Launch.bat

And with that change in place, the next time your computer boots:

  1. AlwaysUp will run “launch.bat”

  2. The batch file will start the latest version of Google Drive and exit

  3. 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:

AlwaysUp running Google Drive as a Windows Service

You will be good to go — no matter how many updates the folks at Google throw at you! 😎

Posted in AlwaysUp | Tagged , , , | 1 Comment

One Response to Q&A: How do I get AlwaysUp to Run the Latest Google Drive for desktop?

  1. Google Drive users,

    We have just published our step-by-step guide showing how to install and run Google Drive for desktop as a Windows Service — in just a few clicks.

Leave a Reply

Your email address will not be published. Required fields are marked *