My head is about to break, and I can only use the substitution method to calculate. The following code is theoretically suitable for permutations within 10 digits, but I don't know why it has problems when it comes to 9 digits. It's frustrating.
[ Last edited by zw19750516 on 2008-6-29 at 07:28 PM ]
@echo off&setlocal enabledelayedexpansion
if exist pl.txt del /q pl.txt
:set
cls&set /p s1=Please enter the character group (please separate characters with spaces):
if not defined s1 goto set
for %%i in (%s1%) do set /a num+=1
for %%a in (%s1%) do (
set s2=!s1:%%a=!
set str=%%a
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%b in (!s2!) do (
set s3=!s2:%%b=!
set str=%%a%%b
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%c in (!s3!) do (
set s4=!s3:%%c=!
set str=%%a%%b%%c
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%d in (!s4!) do (
set s5=!s4:%%d=!
set str=%%a%%b%%c%%d
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%e in (!s5!) do (
set s6=!s5:%%e=!
set str=%%a%%b%%c%%d%%e
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%f in (!s6!) do (
set s7=!s6:%%f=!
set str=%%a%%b%%c%%d%%e%%f
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%g in (!s7!) do (
set s8=!s7:%%g=!
set str=%%a%%b%%c%%d%%e%%f%%g
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%h in (!s8!) do (
set s9=!s9:%%h=!
set str=%%a%%b%%c%%d%%e%%f%%g%%h
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%i in (!s9!) do (
set s10=!s9:%%i=!
set str=%%a%%b%%c%%d%%e%%f%%g%%h%%i
if "!str:~%num%!" neq "" echo !str!>>pl.txt
for %%j in (!s10!) do (
set str=%%a%%b%%c%%d%%e%%f%%g%%h%%i%%j
if "!str:~%num%!" neq "" echo !str!>>pl.txt
))))))))))
start pl.txt
[ Last edited by zw19750516 on 2008-6-29 at 07:28 PM ]
批处理之家新域名:www.bathome.net

