8

I am using google drive to sync personal documents when I am at work and need to update a file at home quickly for personal purposes. I have tasks at home running under task manager, which uses these updated files and sometimes they are time sensitive.

So, I need to set up something, which will force a sync on my home computer's google drive folder, before starting the scheduled task and get the latest updates I made on that file, while I am at work.

So far, all my searching points to pausing and restarting the google drive from the tray icon, in order to force a sync, short of shutting it down and restarting it. I tried and found this scheme to be working, but there is no way to replicate the same function from the command line, i.e., there is no such command line switch as:

googledrivesync.exe /pause 

or

googledrivesync.exe /restart

I tried to set up an autohotkey job to do this mouse pointing and clicking job, but due to the inconsistent number of tray icon's it is a hit and miss at best case.

I also tried to kill the googledrivesync.exe using taskkill and restarting it, but, after the run of googledrivesync.exe runs, it leaves a DOS box on the desktop open. And if this is done few more times (and it gets done as my home computer job runs every 15 minutes) the number of these windows, obstruct the running of my scheduled task due to covering the whole screen.

Any other ideas or undocumented google drive features are greatly appreciated.

  • Probably stop/restart the service via net stop & net start. If someone (or yourself) doesn't have an answer before I can get to a test system this weekend, I'll see if I can get you more details. Google Drive may also have some other command-line parameters you just haven't found yet, but I'm not sure of this and you seem like you've already done enough hunting to render that possibility unlikely. – Iszi Sep 5 '14 at 21:03
  • possible duplicate of Sync Google Drive when not logged in – Ƭᴇcʜιᴇ007 Sep 5 '14 at 21:33
  • No it is not a duplicate of superuser.com/questions/463801/… question. I have seen and read the answers to that but my need is for an "on-demand" update rather than an unattended one – MelBurslan Sep 5 '14 at 21:56
  • @lszi I'm not running it as a service. I start it up on demand, mostly during the day, when I am away from home, and shut it down when I get back home. – MelBurslan Sep 5 '14 at 21:59
  • @MelBurslan Indeed it seems that it doesn't register itself as a service. You could do taskkill to kill it, then another command to re-start. Or PowerShell might be able to do it more gracefully. Let's see if one of those will work, or there might be another solution... – Iszi Sep 6 '14 at 3:50
3
  1. Kill process GoogleDriveSync
  2. In Command Prompt go to folder, c:\program files\Google\drive\
  3. execute googledrivesync.exe /autostart
| improve this answer | |
2

Since you already have a method to end the service, and the only problem is the stub cmd window, just write a little batch script that would:

  1. Execute your method to restart the service
  2. Make the shell to die.

Something like this:

taskkill /fi "Service eq Google Sync"
exit
| improve this answer | |
  • Pardon my ignorance but it looks like your taskkill suggestion is for killing a service. Unless I am totally in dark, my googledrivesync process runs as a regular process, not as a service and I want it to function the same way, i.e., NOT A SERVICE. Is there a way to run this process from the command line and send it to background, so that I can exit the DOS window it ran from, without killing the googledrivesync process ? – MelBurslan Feb 23 '15 at 19:46
  • @MelBurslan actually, taskkill can end process and services, I'm using /fi since it may be a service but you can use /im to filter by name of the process image. – Braiam Feb 24 '15 at 0:01
  • I am familiar with taskkill but my problem still stands (unless googledrivesync.exe has been updated in a major way) . After killing this process, I need to be able to start it from the command line, and I need the dos/cmd window to go away after it completes executing. But, when I run googledrivesync.exe, the executable never releases the command prompt back. So putting it in a batch will not make any difference. Not a windows expert. So if there is trick to send process to background, I am not aware of it. – MelBurslan Feb 25 '15 at 21:27
  • Is this a proper shutdown or a force kill (What I mean taskkill) ? – Chaminda Bandara Sep 24 '18 at 15:04
  • @ChamindaBandara taskkill just sends the kill signal to the process if you use /f. Otherwise it usually sends terminate. – Braiam Sep 24 '18 at 17:55
2

This is an old question. But since this showed up when I was searching for the same problem. Here is what I did.

A small C# app that should do what OP would like for 'googledrivesync.exe /restart'

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace StartStopGDrive
{
  class Program
  {
    static void Main(string[] args)
    { 
      Process[] procs = Process.GetProcesses();
      foreach (Process proc in procs)
      {
        if (proc.ProcessName == "googledrivesync")
          proc.Kill();
      }
      Process.Start(@"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Google Drive\Google Drive");
    }
  }
}
| improve this answer | |
1

I dont knw if i am late but this is what I am using since last 3 to 4 years to backup my data to gdrive. I just click an icon of batch file I have created and below line is part of it. This will start google drive from within a batch file. Hope this helps.

c:> Start C:\Progra~1\Google\Drive\google~1.exe

using start command wont leave black dos box open :-)

To terminate the google drive

you can use command from dos prompt

taskkill /f /im googledrivesync.exe

hope this helps.

Apoorva

| improve this answer | |
  • In case there is second Google drive running then taskkill /f /im google~1.exe – MotsManish Dec 7 '18 at 13:12
0

There is only one way to force a sync in Google Drive. You need to have a "Conflicting File" that Google can't sync (corrupted or whatever). You then right click the Gdrive icon, select the "View Unsyncable Files" and click "Retry".

Works everytime and am syncing 15 cloud servers to each other. PITA, they should have an option to force the resync but we all know why they don't - bandwidth. Google has turned down the resync frequency to lower costs, plain and simple.

| improve this answer | |
-4

Have written a little app just to address this problem it will restart Google Drive app periodically hence forcing resync. Hope it helps :)

Automate - Force Google Drive to Sync Files

| improve this answer | |
  • 3
    Can you explain in more detail what it does and cost? VirusTotal came up mostly clean, only one shows it as problematic: Kingsoft Win32.Troj.IAgent.wt.(kcloud) 20150211 – Sun Feb 11 '15 at 20:41
  • sorry but your application doesn't do anything for me. It is still graphical (dependent on tray icon) and it is periodic. I need something that I can run from the command line and on demand. – MelBurslan Feb 23 '15 at 19:43
  • It's false positive alert. And isn't your objective to have the latest file before tasks pick them up? My app just does that keeps the copy fresh. But if you want, i can send you .exe which will just restart Google Drive without running periodically. So you can run it on demand or schedule as you wish. – Shunmugh Sundaram Feb 25 '15 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.