找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 22234|回复: 5

[网络连接] [分享]批处理穷举法获取台式机NVIDIA历史版本驱动脚本

[复制链接]
发表于 2023-5-24 19:51:37 | 显示全部楼层 |阅读模式
本帖最后由 yakeyun 于 2023-5-27 21:51 编辑

此脚本可以用来获取NVIDIA显卡的历史版本,并记录有效的版本号和对应的下载链接,同时下载文件到本目录。
版本号是利用累加自动生成新版本号,然后利用系统自带的CURL工具下载对应文件,再通过判断下载文件是否大于100M,如果大于100M就判断为有效文件,并记录下版本号和下载链接,如果小于100M就删除下载文件。
  1. ::最新版532.03
  2. @echo off
  3. setlocal EnableDelayedExpansion
  4. title 穷举法NVIDIA历史版本驱动获取...
  5. mode con cols=80 lines=5
  6. color 2
  7. set ver=531

  8. :loop
  9. cls
  10. echo 当前获取版本:!ver!
  11. curl -O https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe
  12. set "NVIDIA=0"
  13. for %%F in ("!abc!.!de!-desktop-win10-win11-64bit-international-dch-whql.exe") do (
  14.     if %%~zF GTR 104857600 (
  15.         set "NVIDIA=1"
  16.     )
  17. )
  18. if %NVIDIA% EQU 1 (
  19.     echo !abc!.!de!:https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe >>ValidData.ini
  20. ) else (
  21.     del /f "!ver!-desktop-win10-win11-64bit-international-dch-whql.exe"
  22. )
  23. for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a"
  24. goto :loop

复制代码
最终获取到的有效文件会被保存到当前目录ValidData.ini文件中,其内容如下:
  1. 531.18:https://cn.download.nvidia.cn/Windows/531.18/531.18-desktop-win10-win11-64bit-international-dch-whql.exe
  2. 531.29:https://cn.download.nvidia.cn/Windows/531.29/531.29-desktop-win10-win11-64bit-international-dch-whql.exe
  3. 531.41:https://cn.download.nvidia.cn/Windows/531.41/531.41-desktop-win10-win11-64bit-international-dch-whql.exe
  4. 531.61:https://cn.download.nvidia.cn/Windows/531.61/531.61-desktop-win10-win11-64bit-international-dch-whql.exe
  5. 531.68:https://cn.download.nvidia.cn/Windows/531.68/531.68-desktop-win10-win11-64bit-international-dch-whql.exe
  6. 531.79:https://cn.download.nvidia.cn/Windows/531.79/531.79-desktop-win10-win11-64bit-international-dch-whql.exe
  7. 532.03:https://cn.download.nvidia.cn/Windows/532.03/532.03-desktop-win10-win11-64bit-international-dch-whql.exe
复制代码
发表于 2023-5-27 22:46:12 | 显示全部楼层
本帖最后由 went 于 2023-5-27 22:47 编辑

可以用--head选项读取响应头,免去下载不必要的文件
  1. 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,然后再进行常规下载

评分

参与人数 1技术 +1 收起 理由
yakeyun + 1 乐于助人,技术达人。

查看全部评分

 楼主| 发表于 2023-5-28 10:25:04 | 显示全部楼层
回复 2# went
谢谢大佬给的思路,已经根据其重新写了一版。
  1. ::最新版532.03
  2. @echo off
  3. setlocal EnableDelayedExpansion
  4. title 穷举法NVIDIA历史版本驱动获取...
  5. mode con cols=80 lines=5
  6. color 2
  7. set ver=531

  8. :loop
  9. cls
  10. echo 当前获取版本:!ver!
  11. 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"
  12. if !dates! equ 404 (for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a" & goto :loop)

  13. if not exist !ver!-desktop-win10-win11-64bit-international-dch-whql.exe (
  14. curl -O https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe
  15. echo !abc!.!de!:https://cn.download.nvidia.cn/Windows/!ver!/!ver!-desktop-win10-win11-64bit-international-dch-whql.exe >>ValidData.ini
  16. )

  17. for /f %%a in ('powershell -command "!ver! + 0.01"') do set "ver=%%a"
  18. goto :loop
复制代码
发表于 2023-7-26 16:49:40 | 显示全部楼层
https://github.com/lord-carlos/nvidia-update

获取最新的 驱动,要是bat就好了
发表于 2023-7-26 21:49:30 | 显示全部楼层
回复 4# jifeiyun


    试试这个 http://bbs.bathome.net/thread-66893-1-1.html
发表于 2023-7-27 16:38:24 | 显示全部楼层
回复 5# Batcher 大佬神速操作 牛X
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 19:36 , Processed in 0.020052 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表