523066680 (消遣区)当前离线
版主
@echo off :get_key set "key=" for /f "delims=" %%a in ('xcopy /w "%~f0" "%~f0" 2^>nul') do if not defined key set "key=%%a" set "key=%key:~-1%" echo %key% pause复制代码
评分人数
ANSL 当前离线
禁止访问
TOP
Echo11 当前离线
一级士官
这个方式好象能支持比 choice 更多的字符, 比如 , . / Tab 字符, 甚至组合键 Ctrl+A Ctrl+Q 等
echo.key is:(%key%)复制代码
key is:)复制代码
netbenton (秋风夜雨)当前离线
荣誉版主
for /F "tokens=2 delims=键" %%L in ('xcopy /w . 2^>nul') do set k=%%L复制代码
CrLf 当前离线
论坛巡查
futurer 当前离线
列兵
aa77dd@163.com (aa77dd@163.com)当前离线
禁止发言
certutil -decode certutil -decodehex复制代码
xcopy /w . 2^>NUL复制代码
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"复制代码
For /F delims^=^ eol^= %%Z in ("!Char!") Do Set "Intro=0"复制代码
Echo(复制代码
happy886rr 当前离线
等待验证会员
xcopy /w . . 2^>NUL 或者 xcopy /w \ \ 2^>NUL复制代码
@echo off setlocal EnableDelayedExpansion if "%~1"==":::" goto :spinnerThread :menuLoop <nul set /p menu=Select menu[1 or 2]= call :GetKey echo( echo Pressed '!key!' if !key!==1 call :menu1 if !key!==2 call :menu2 if !key!==2 call :menu2 goto :menuLoop :menu1 :menu2 call :spinnerStart rem do some work ping localhost -n 3 > nl call :spinnerStop echo Finished exit /b :spinnerStart del spinnerStop.tmp > nul 2>&1 start /b "" cmd /c "%~df0" ::: exit /b :spinnerStop echo dummy > spinnerStop.tmp :__spinnerStop if exist spinnerStop.tmp goto :__spinnerStop exit /b :spinnerThread for /f %%a in ('copy /Z "%~f0" nul') do set "CR=%%a" set "spinChars=\|/-" :spinnerLoop set /a "spinner=(spinner + 1) %% 4" <nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!" ping localhost -n 2 > nul 2>&1 if not exist spinnerStop.tmp goto :spinnerLoop del spinnerStop.tmp > nul 2>&1 echo( exit /b :GetKey set "key=" for /F "usebackq delims=" %%L in (`xcopy /L /w "%~f0" "%~f0" 2^>NUL`) do ( if not defined key set "key=%%L" ) set "key=%key:~-1%" exit /b复制代码