Synching Google Drive from the command line

I experienced problems on a laptop running Windows 8 after warnings appeared about depletion of available memory on the system. After I closed applications to free a substantial amount of memory, the problems remained. I couldn't reboot immediately, because I still had a lot of files open in various applications that I needed to deal with. I had created a folder in the directory on my laptop used for Google Drive two days ago, but that folder wasn't appearing when I logged into my Google Drive account on another Windows system and checked my files through using a browser on that system. I couldn't force Google Drive to sync on the laptop through its system tray icon because the icons I would normally see in the notification area weren't visible due to the memory issue. So I thought there might be a way to synch Google drive from a command prompt, but when I searched online, I found postings indicating Google hasn't provided any command line options for its sync program. There seems to be no way to force a synchronization between local storage on a computer and Google's cloud service without restaring the program Google uses for synchronizations, so I looked for the running process that would handle the syncing.

C:\>tasklist | find /i "Google" | more
GoogleUpdate.exe            171064 Services                   0        380 K
googledrivesync.exe          50768 Console                    1      3,184 K
googledrivesync.exe         197928 Console                    1     52,736 K

C:\>tasklist /fi "imagename eq googledrivesync.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
googledrivesync.exe          50768 Console                    1      3,184 K
googledrivesync.exe         197928 Console                    1     52,736 K

I found two googledrivesync.exe processes running. When I tried to kill them without the /f option to taskkill, the attempt to terminate the processes failed.

Learn on Udemy Today!
C:\>taskkill /fi "imagename eq googledrivesync.exe"
ERROR: The process with PID 50768 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).
SUCCESS: Sent termination signal to the process with PID 197928.

C:\>tasklist /fi "imagename eq googledrivesync.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
googledrivesync.exe          50768 Console                    1      3,184 K
googledrivesync.exe         197928 Console                    1     52,768 K

When I used the /f option I was able to stop the processes.

C:\>taskkill /f /fi "imagename eq googledrivesync.exe"
SUCCESS: The process with PID 50768 has been terminated.
SUCCESS: The process with PID 197928 has been terminated.


When I checked for the location of the file on the system by running dir /s from the root directory of drive C:, I found several copies:

Malwarebytes Anti-Malware Premium
C:\>dir /s googledrivesync.exe
 Volume in drive C is TI10664600G
 Volume Serial Number is 0E19-9C92

 Directory of C:\Program Files (x86)\Google\Drive

10/12/2015  12:08 PM        22,568,216 googledrivesync.exe
               1 File(s)     22,568,216 bytes

 Directory of C:\Users\JDoe\AppData\Local\Temp\tmpbrlrx4

09/11/2015  12:56 PM        22,568,208 googledrivesync.exe
               1 File(s)     22,568,208 bytes

 Directory of C:\Users\JDoe\AppData\Local\Temp\tmpcvupqu

07/29/2015  09:23 AM        22,344,224 googledrivesync.exe
               1 File(s)     22,344,224 bytes

 Directory of C:\Users\JDoe\AppData\Local\Temp\tmpjk1iai

06/20/2015  01:48 PM        22,012,688 googledrivesync.exe
               1 File(s)     22,012,688 bytes

I don't know why the extra copies with different sizes are present on the system, but I was able to restart the process using the program in C:\Program Files (x86)\Google\Drive.

C:\>"C:\Program Files (x86)\Google\Drive\googledrivesync"


When I started the program from the command line, a blank command prompt window opened and remained open. Two googledrivesync processes remained running when I closed that command prompt window.

C:\>tasklist /fi "imagename eq googledrivesync.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
googledrivesync.exe         195156 Console                    1      3,224 K
googledrivesync.exe         202416 Console                    1     68,468 K


When I subsequently terminated and restarted googledrivesync, I didn't see a command prompt window open.

Killing and restarting googledrivesync always seems to result in two googledrivesysnc processes running afterwards, one using considerably less memory than the other. I found some online speculating that one handles downloads and other uploads to the Google cloud, but no definitive answer as to why two processes run.

Google Drive was still not syncing, but I finally got it to synch after terminating the "Google Drive (32 bit)" process from the Windows Task Manager then right-clicking on Windows Exporer in the Task Manager and choosing Restart, then restarting googledrivesync.exe from the command line. At that point, a Google Drive notice appeared in the notification area in the lower-right, hand corner of the screen with the message "Google Drive - Error - click here to sign in again".

Google Drive - Error - click to
sign in again

I clicked on that message and was able to log into Google Drive. I then saw a notice that synchronization was occurring, i.e., "Google Drive - Synching 145 of 515".

Google Drive Synching

When synchronization was complete, I saw the message "Google Drive - Sync Complete" when I moved the mouse pointer over the Google Drive icon in the notification area.

Google Drive Sync Complete

The Google Drive icon is a three-colored (green, yellow, and blue) triangular icon which appears in the notification area, if you set the Google Drive preferences to display it.

Google Drive Icon

You can change the preferences by right-clicking on the icon, then clicking on the series of 3 dots one below the other, then clicking on Preferences, and then clicking on the Advanced tab.

Google Drive advanced

After the "Google Drive Sync Complete" message appeared on the laptop, the new folder I needed to access on the other system appeared in the Google Drive browser tab and I was able to upload files to it from the other system by dragging them from the Windows Explorer onto the folder in the browser tab.


TechRabbit ad 300x250

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Tuesday October 20, 2015