|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
还有版主 下面代码为什么 只显示 b%%而不是123? 变量不可以堪套吗?
CODE:
--------------------------------------------------------------------------------
set a=123456789
set b=3
echo %a:~0,%b%%
这就是为什么要用setlocal ENABLEDELAYEDEXPANSION来启用延时的环境变量的原因。当然,并不是说不启用延时的环境变量就不能实现变量的嵌套,比如用显示命令的叠加来转换:
echo %a:~0,^%b%^% | findstr .
There is also the forum moderator. Why does the following code only display b%% instead of 123? Can variables not be nested?
CODE:
--------------------------------------------------------------------------------
set a=123456789
set b=3
echo %a:~0,%b%%
This is why you need to use setlocal ENABLEDELAYEDEXPANSION to enable delayed environment variables. Of course, it doesn't mean that you can't achieve variable nesting without enabling delayed environment variables. For example, you can convert it by superimposing display commands:
echo %a:~0,^%b%^% | findstr .
|
|
2006-5-16 19:53 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
|
2006-5-16 20:45 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
延时是采用3742668兄的代码,不过效果我觉得不怎么好
@echo off
setlocal enabledelayedexpansion
set /a b=81
set a=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>================================================================================"
:back
cls
for /l %%i in (1,1,20) do @echo.
echo Loading Windows 2000...
set /a b-=1
echo !a:~%b%,80!
if !b! == 1 goto :eof
call :delay 80
goto back
:delay
set /a num=num + 1
if %num% geq %1 (set num=) && goto :eof
goto delay
The delay uses the code of brother 3742668, but I think the effect is not very good
@echo off
setlocal enabledelayedexpansion
set /a b=81
set a=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>================================================================================"
:back
cls
for /l %%i in (1,1,20) do @echo.
echo Loading Windows 2000...
set /a b-=1
echo !a:~%b%,80!
if !b! == 1 goto :eof
call :delay 80
goto back
:delay
set /a num=num + 1
if %num% geq %1 (set num=) && goto :eof
goto delay
|
|
2006-5-17 11:23 |
|
|
maya0su
中级用户
  
积分 241
发帖 131
注册 2005-9-28
状态 离线
|
|
2006-7-24 16:25 |
|
|
maya0su
中级用户
  
积分 241
发帖 131
注册 2005-9-28
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
现在在SP2的环境下测试,情况依旧!
Now testing under the SP2 environment, the situation remains the same!
|

房东说:这娃是个好孩子! |
|
2006-7-26 02:59 |
|
|
voiL
中级用户
  
积分 384
发帖 189
注册 2005-10-19
状态 离线
|
|
2006-7-27 05:22 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
基于以上诸位的探讨
我来给个总结性的发言
批处理如下
@echo off
setlocal EnableDelayedExpansion
set _tmp_F_S=C:\_delay.vbs
set _tmp_F_F=C:\_tmp.tmp
set delay=50
set s1=开机
set s2=快开机
set s3=他妈的开机
set s4=你他妈到底开不开机
set s5=操!!再不开机老子砸了你!!
echo if WScript.Arguments.count = 1 then WScript.Sleep CInt(WScript.Arguments(0)) end if>%_tmp_F_S%
if exist %_tmp_F_F% del %_tmp_F_F%
for /L %%i in (1,1,4) do (call :show %%s%%i%% && call :fail %%s%%i%%)
call :show %s5%
call :suc
if exist %_tmp_F_S% del %_tmp_F_S%
if exist %_tmp_F_F% del %_tmp_F_F%
ping -n 1 127.1>nul
goto :EOF
:show
if "%~1"=="" goto :EOF
set s=%1
set /p ans=%cd%^><nul
set /A len=0
:comp_len
echo %%s:~%len%,1%% | find "ECHO">nul && goto end_comp
set /A "len+=1"
goto comp_len
:end_comp
set /A "len-=1"
for /L %%i in (0,1,%len%) do (cscript //nologo %_tmp_F_S% %delay% && set /p ans=!s:~%%i,1!<nul)
cscript //nologo %_tmp_F_S% 500
echo.
echo %cd%^>%1>>%_tmp_F_F%
echo.>>%_tmp_F_F%
goto :EOF
:fail
echo '%1' 不是内部或外部命令,也不是可运行的程序
echo 或批处理文件。
echo.
echo '%1' 不是内部或外部命令,也不是可运行的程序>>%_tmp_F_F%
echo 或批处理文件。>>%_tmp_F_F%
echo.>>%_tmp_F_F%
goto :EOF
:suc
ping -n 1 127.1>nul
set eqq================================================================================
set gtr=^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>
echo Loading Windows 2000 ...>>%_tmp_F_F%
echo.>>%_tmp_F_F%
for /L %%i in (0,1,79) do (set /A new=2*%%i && type %_tmp_F_F% && echo !gtr:~0,%%i!!eqq:~%%i,80! && ping -n 1 127.1>nul && cls)
goto :EOF
Based on the discussions of the诸位 above, I'll give a summary speech. The batch processing is as follows:
@echo off
setlocal EnableDelayedExpansion
set _tmp_F_S=C:\_delay.vbs
set _tmp_F_F=C:\_tmp.tmp
set delay=50
set s1=Booting
set s2=Booting fast
set s3=Damn it, booting
set s4=Are you going to boot or not, you bastard
set s5=Damn it!! If you don't boot again, I'll smash you!!
echo if WScript.Arguments.count = 1 then WScript.Sleep CInt(WScript.Arguments(0)) end if>%_tmp_F_S%
if exist %_tmp_F_F% del %_tmp_F_F%
for /L %%i in (1,1,4) do (call :show %%s%%i%% && call :fail %%s%%i%%)
call :show %s5%
call :suc
if exist %_tmp_F_S% del %_tmp_F_S%
if exist %_tmp_F_F% del %_tmp_F_F%
ping -n 1 127.1>nul
goto :EOF
:show
if "%~1"=="" goto :EOF
set s=%1
set /p ans=%cd%^><nul
set /A len=0
:comp_len
echo %%s:~%len%,1%% | find "ECHO">nul && goto end_comp
set /A "len+=1"
goto comp_len
:end_comp
set /A "len-=1"
for /L %%i in (0,1,%len%) do (cscript //nologo %_tmp_F_S% %delay% && set /p ans=!s:~%%i,1!<nul)
cscript //nologo %_tmp_F_S% 500
echo.
echo %cd%^>%1>>%_tmp_F_F%
echo.>>%_tmp_F_F%
goto :EOF
:fail
echo '%1' is not an internal or external command, nor a runnable program
or batch file.
echo '%1' is not an internal or external command, nor a runnable program>>%_tmp_F_F%
or batch file.>>%_tmp_F_F%
echo.>>%_tmp_F_F%
goto :EOF
:suc
ping -n 1 127.1>nul
set eqq================================================================================
set gtr=^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>^>
echo Loading Windows 2000 ...>>%_tmp_F_F%
echo.>>%_tmp_F_F%
for /L %%i in (0,1,79) do (set /A new=2*%%i && type %_tmp_F_F% && echo !gtr:~0,%%i!!eqq:~%%i,80! && ping -n 1 127.1>nul && cls)
goto :EOF
|
|
2006-10-2 03:49 |
|
|
gzdx0615
新手上路

积分 10
发帖 3
注册 2006-10-3
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
Originally posted by my3439955 at 2006-10-2 03:49:
基于以上诸位的探讨
我来给个总结性的发言
批处理如下
@echo off
setlocal EnableDelayedExpansion
set _tmp_F_S=C:\_delay.vbs
set _tmp_F_F=C:\_tmp.tmp
set delay ...
行是行/但是到了最后会一直重复前面的内容
Originally posted by my3439955 at 2006-10-2 03:49:
Based on the discussions of the诸位 above
I will give a summary speech
The batch processing is as follows
@echo off
setlocal EnableDelayedExpansion
set _tmp_F_S=C:\_delay.vbs
set _tmp_F_F=C:\_tmp.tmp
set delay ...
The lines are in order / but in the end it will keep repeating the previous content
|
|
2006-10-3 09:08 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
不明白楼上的意思
是不是说最后屏幕的闪烁?
I don't understand what the person above means. Is it saying the screen flickering at the end?
|
|
2006-10-5 22:28 |
|
|
bg
初级用户
 
积分 118
发帖 34
注册 2006-1-10
状态 离线
|
『第 25 楼』:
我写的,个人感觉还好。
使用 LLM 解释/回答一下
@echo off
color 1f
title.
mode con lines=10
rem 进度条 ▉▉▉▉▉
set work=0
set n=0
set mo=0
set number=0
rem all是总数
set all=60
set time=%all%
:show
:check
if %number% GTR %mo% set num=%num%▉&set /a mo=%mo%+1&goto check
:2
cls
echo 进度: %n% / %all% 剩余时间:%time%秒
echo.
echo.
echo 完成 %work% %%%
echo.
if not "%num%"=="" echo %num%
if not "%num%"=="" echo %num%
if %work%==100 goto end
ping 127.1 -n 3 >nul
set /a n=%n%+1
set /a time=%all%-%n%
set /a work=(%n%)*100/(%all%)
set /a number=%work%/3
set /a number=%number%+1
goto show
endlocal
:end
endlocal
pause>nul
```batch
@echo off
color 1f
title.
mode con lines=10
rem Progress bar ▉▉▉▉▉
set work=0
set n=0
set mo=0
set number=0
rem all is the total number
set all=60
set time=%all%
:show
:check
if %number% GTR %mo% set num=%num%▉&set /a mo=%mo%+1&goto check
:2
cls
echo Progress: %n% / %all% Remaining time: %time% seconds
echo.
echo.
echo Completed %work% %%%
echo.
if not "%num%"=="" echo %num%
if not "%num%"=="" echo %num%
if %work%==100 goto end
ping 127.1 -n 3 >nul
set /a n=%n%+1
set /a time=%all%-%n%
set /a work=(%n%)*100/(%all%)
set /a number=%work%/3
set /a number=%number%+1
goto show
endlocal
:end
endlocal
pause>nul
```
|
|
2006-10-8 23:43 |
|
|
weilong888
银牌会员
    
积分 1270
发帖 548
注册 2004-5-31
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
很有意思的,试了一下,真的可行。
It's very interesting. I tried it and it really works.
|
|
2006-10-9 01:01 |
|
|
h2o
初级用户
 
积分 44
发帖 18
注册 2006-10-9
状态 离线
|
|
2006-10-9 10:42 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
Originally posted by bg at 2006-10-8 23:43:
@echo off
color 1f
title.
mode con lines=10
rem 进度条 ▉▉▉▉▉
set work=0
set n=0
set mo=0
set number=0
rem all是总数
set all=60
set time=%all%
:show
:check
if %num ...
很好哈~正想要这个的
Originally posted by bg at 2006-10-8 23:43:
@echo off
color 1f
title.
mode con lines=10
rem Progress bar ▉▉▉▉▉
set work=0
set n=0
set mo=0
set number=0
rem all is the total number
set all=60
set time=%all%
:show
:check
if %num ...
Nice~ Just what I was looking for
|
|
2006-10-9 21:51 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-11-4 11:46 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
就是,晕,抄也不写出处,bs
Just, dizzy, copy without writing the source, BS
|
|
2006-11-5 05:39 |
|