本帖最后由 qixiaobin0715 于 2023-8-9 15:13 编辑
- @echo off
- set "pwd=0b123b=c456p;i987"
- setlocal enabledelayedexpansion
- for %%i in (%pwd%) do set var=!var!%%i
- set pwd1=a%var%a
- set pwd2=a%var%a
- for /l %%i in (0,1,9) do set pwd1=!pwd1:%%i= !
- for %%i in (%pwd1%) do (
- set pwd2=1!pwd2:*%%i=!
- set /a n=pwd2
- set n=!n:~1!
- if defined n set m=!m!!n!
- )
- if defined m (echo,%m%) else (No Numbers)
- pause
复制代码 代码第4-6行是对变量值进行规整;后面与5楼代码大同小异,思路基本相同。
如果含有(&<等)特殊字符则代码无效。 |