标题: [其他] 批处理在循环中输入任务,运行完后又回到输入的地方 [打印本页]
作者: leo.liu 时间: 2020-6-23 12:27 标题: 批处理在循环中输入任务,运行完后又回到输入的地方
循环语句
在循环中输入任务,运行完后又回到输入的地方
作者: smss 时间: 2020-6-23 13:25
本帖最后由 smss 于 2020-6-23 13:30 编辑
栗子- @echo off
- :Cho
- cls
- echo 1.复制软件 A.获取电脑信息
- choice /C:1234567890ABCDEFGHIJKL /N /M ">>输入选择>
- goto %errorlevel%
- :1
- for %%i in (CPU-Z GPU-Z SSD-Z HDTune 测显示器 键盘检测 硬盘检测 硬盘测速 硬件检测) do if not exist "%userprofile%\desktop\电脑检测\%%i.exe" copy "%~dp0工具\检测\%%i.exe" "%userprofile%\desktop\电脑检测\"
- goto Cho
- :11
- echo 登录名:%USERNAME%
- echo 计算机名:%COMPUTERNAME%
- for /f "tokens=2 delims==" %%a in ('wmic os get caption /value ^| findstr /i "caption"') do echo 操作系统:%%a
- for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo 制造商:%%a
- for /f "tokens=2 delims==" %%a in ('wmic csproduct get Name /value ^| findstr /i "Name"') do echo 电脑型号:%%a
- for /f "tokens=2 delims==" %%a in ('wmic csproduct get IdentifyingNumber /value ^| findstr /i "IdentifyingNumber"') do echo SN序列号:%%a
- for /f "tokens=2 delims==" %%a in ('wmic cpu get Name /value ^| findstr /i "Name"') do echo 处理器:%%a
- for /f "tokens=2 delims==" %%i in ('Wmic Path Win32_VideoController Get Name^,AdapterRam^,AdapterCompatibility^,DriverDate^,DriverVersion^,VideoProcessor /Value') do (set /a N+=1
- if !N! == 1 set AdapterCompatibility=%%i
- if !N! == 2 set AdapterRam=%%i
- if !N! == 3 set DriverDate=%%i
- if !N! == 4 set DriverVersion=%%i
- if !N! == 5 set Name=%%i
- if !N! == 6 set VideoProcessor=%%i
- )
- echo 显卡信息:%Name%
- for /f "tokens=2 delims==" %%a in ('wmic memorychip get Capacity /value ^| findstr /i "Capacity"') do echo 内存容量:%%a
- for /f "tokens=2 delims==" %%a in ('wmic DiskDrive get Size /value ^| findstr /i "Size"') do echo 硬盘容量:%%a
- goto Cho
复制代码
作者: leo.liu 时间: 2020-6-24 07:38
回复 2# smss - choice /C:1234567890ABCDEFGHIJKL /N /M ">>输入选择>
复制代码
是循环 输入吗?输入后储存在哪个变量里
对不起,是新手,麻烦您了
作者: Batcher 时间: 2020-6-24 13:41
回复 3# leo.liu
在系统变量 %errorlevel% 里面
作者: leo.liu 时间: 2020-6-24 20:24
[url=做一个只能最大化,按X或结束进程都关不了的bat http://www.bathome.net/viewthread.php?tid=56126]做一个只能最大化,按X或结束进程都关不了的bat http://www.bathome.net/viewthread.php?tid=56126[/url]
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |