本帖最后由 yakeyun 于 2022-5-11 19:58 编辑
回复 3# ANSL
代码执行速度过快,且执行结束加了PAUSE命令的就没效果(可以把“timeout -t 20” 命令删除,然后把“exit”改成“pause”测试一下)。
给你一个案例,你可以尝试把“timeout -t 20” 命令加入,或者删除体验一下:
运行正常:- @echo off&setlocal enabledelayedexpansion
- cd /d "%~dp0
-
- if not exist jiaoyan.dll (>jiaoyan.dll echo,我是校验文件) else (exit)
-
- title AMI主板BIOS信息查看工具v1.0 By.JT.sanli
- for /f "delims== tokens=1,*" %%a in ('wmic baseboard get Product^/value ^|find "="') do set "name=%%b"
- for /f "delims== tokens=1,*" %%c in ('wmic bios get SMBIOSBIOSVersion^/value ^|find "="') do set "bios=%%d"
- echo,主板型号:%name% BIOS版本:%bios%
- echo.
-
- timeout -t 20
-
- if exist jiaoyan.dll (del jiaoyan.dll)
-
- exit
复制代码 运行失效:- @echo off&setlocal enabledelayedexpansion
- cd /d "%~dp0
-
- if not exist jiaoyan.dll (>jiaoyan.dll echo,我是校验文件) else (exit)
-
- title AMI主板BIOS信息查看工具v1.0 By.JT.sanli
- for /f "delims== tokens=1,*" %%a in ('wmic baseboard get Product^/value ^|find "="') do set "name=%%b"
- for /f "delims== tokens=1,*" %%c in ('wmic bios get SMBIOSBIOSVersion^/value ^|find "="') do set "bios=%%d"
- echo,主板型号:%name% BIOS版本:%bios%
- echo.
-
- if exist jiaoyan.dll (del jiaoyan.dll)
-
- pause
复制代码
|