标题: [网络连接] [分享]批处理穷举法获取台式机NVIDIA历史版本驱动脚本 [打印本页]
作者: yakeyun 时间: 2023-5-24 19:51 标题: [分享]批处理穷举法获取台式机NVIDIA历史版本驱动脚本
本帖最后由 yakeyun 于 2023-5-27 21:51 编辑
此脚本可以用来获取NVIDIA显卡的历史版本,并记录有效的版本号和对应的下载链接,同时下载文件到本目录。
版本号是利用累加自动生成新版本号,然后利用系统自带的CURL工具下载对应文件,再通过判断下载文件是否大于100M,如果大于100M就判断为有效文件,并记录下版本号和下载链接,如果小于100M就删除下载文件。- ::最新版532.03
- @echo off
- setlocal EnableDelayedExpansion
- title 穷举法NVIDIA历史版本驱动获取...
- mode con cols=80 lines=5
- color 2
- set ver=531
-
- :loop
- cls
- echo 当前获取版本:!ver!
- curl -O https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe
- set "NVIDIA=0"
- for %%F in ("!abc!.!de!-desktop-win10-win11-64bit-international-dch-whql.exe") do (
- if %%~zF GTR 104857600 (
- set "NVIDIA=1"
- )
- )
- if %NVIDIA% EQU 1 (
- echo !abc!.!de!:https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe >>ValidData.ini
- ) else (
- del /f "!ver!-desktop-win10-win11-64bit-international-dch-whql.exe"
- )
- for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a"
- goto :loop
复制代码
最终获取到的有效文件会被保存到当前目录ValidData.ini文件中,其内容如下:- 531.18:https://cn.download.nvidia.cn/Windows/531.18/531.18-desktop-win10-win11-64bit-international-dch-whql.exe
- 531.29:https://cn.download.nvidia.cn/Windows/531.29/531.29-desktop-win10-win11-64bit-international-dch-whql.exe
- 531.41:https://cn.download.nvidia.cn/Windows/531.41/531.41-desktop-win10-win11-64bit-international-dch-whql.exe
- 531.61:https://cn.download.nvidia.cn/Windows/531.61/531.61-desktop-win10-win11-64bit-international-dch-whql.exe
- 531.68:https://cn.download.nvidia.cn/Windows/531.68/531.68-desktop-win10-win11-64bit-international-dch-whql.exe
- 531.79:https://cn.download.nvidia.cn/Windows/531.79/531.79-desktop-win10-win11-64bit-international-dch-whql.exe
- 532.03:https://cn.download.nvidia.cn/Windows/532.03/532.03-desktop-win10-win11-64bit-international-dch-whql.exe
-
复制代码
作者: went 时间: 2023-5-27 22:46
本帖最后由 went 于 2023-5-27 22:47 编辑
可以用--head选项读取响应头,免去下载不必要的文件- curl --head https://cn.download.nvidia.cn/Windows/531.18/531.18-desktop-win10-win11-64bit-international-dch-whql.exe 2>&1 | findstr /b /C:"HTTP/" /C:"Content-Length:"
复制代码
HTTP状态码为200表示存在当前版本文件
Content-Length如果大于104857600则表示当前版本文件大于100M,然后再进行常规下载
作者: yakeyun 时间: 2023-5-28 10:25
回复 2# went
谢谢大佬给的思路,已经根据其重新写了一版。- ::最新版532.03
- @echo off
- setlocal EnableDelayedExpansion
- title 穷举法NVIDIA历史版本驱动获取...
- mode con cols=80 lines=5
- color 2
- set ver=531
-
- :loop
- cls
- echo 当前获取版本:!ver!
- for /f "tokens=2* delims=^ " %%a in ('curl --head https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe 2^>^&1 ^| findstr /b /C:"HTTP/" ') do set "dates=%%a"
- if !dates! equ 404 (for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a" & goto :loop)
-
- if not exist !ver!-desktop-win10-win11-64bit-international-dch-whql.exe (
- curl -O https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe
- echo !abc!.!de!:https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe >>ValidData.ini
- )
-
- for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a"
- goto :loop
复制代码
作者: jifeiyun 时间: 2023-7-26 16:49
https://github.com/lord-carlos/nvidia-update
获取最新的 驱动,要是bat就好了
作者: Batcher 时间: 2023-7-26 21:49
回复 4# jifeiyun
试试这个 http://bbs.bathome.net/thread-66893-1-1.html
作者: jifeiyun 时间: 2023-7-27 16:38
回复 5# Batcher 大佬神速操作 牛X
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |