[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

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

本帖最后由 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
复制代码

本帖最后由 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

评分人数

    • yakeyun: 乐于助人,技术达人。技术 + 1

TOP

回复 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
复制代码

TOP

https://github.com/lord-carlos/nvidia-update

获取最新的 驱动,要是bat就好了

TOP

回复 4# jifeiyun


    试试这个 http://bbs.bathome.net/thread-66893-1-1.html
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 5# Batcher 大佬神速操作 牛X

TOP

返回列表