有没有办法从google drive使用命令下载文件?每当我尝试这样做时,它会下载网站的内容,而不是exe。我正在制作一个自动下载器,无论何时按下都会下载最新的补丁。救命啊!
答案 0 :(得分:0)
使用wget:
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME
但我使用其他方式下载文件和文件夹,因为如果您要更改文件,则会使用新文件ID。
尝试使用:https://github.com/prasmussen/gdrive用于Windows / Linux / Mac
使用drive.exe:
drive download --id 0B3X9GlR6EmbnenBYSFI4MzN0d2M
并且,为了下载文件夹,我写了BAT文件
@echo off
::USAGE: PATH\TO\THISFILE.BAT "ID"
setlocal enabledelayedexpansion
set DRIVEBAT=%PROGRAMFILES%\Google Drive Downloader\drivefolder.bat
set DRIVECONF=%PROGRAMFILES%\Google Drive Downloader\.gdrive
if "%1"=="" exit
set FOLDERID=%1
for /f "usebackq tokens=*" %%a in (`drive -c "%DRIVECONF%" info -i %FOLDERID% ^| find "Title: "`) do (
set "FOLDERNAME=%%a"
set "FOLDERNAME=!FOLDERNAME:Title: =!"
echo Downloading [!FOLDERNAME!] dir...
)
rd /s /q !FOLDERNAME! >nul 2>&1
md "!FOLDERNAME!\"
cd "!FOLDERNAME!\"
for /f "usebackq tokens=1" %%a in (`drive -c "%DRIVECONF%" list -q "'%FOLDERID%' in parents" -n`) do (
drive -c "%DRIVECONF%" download -i %%a >nul || (
echo.
timeout /t 3 >nul 2>&1
start "" cmd.exe /c call "%DRIVEBAT%" "%%a"
)
)
exit
安装bat:
用法蝙蝠:
cmd.exe /c cd "C:\destenetionfolder" & call "drivefolder.bat" "0FG6kgDTKrk6ERKTY45klDHdldGc"