Batch file 查找随机代码并导出它们
我在做一个谜型的 我需要找到随机代码(字符可以重复)并将其导出到.txt文件 下面是我的代码,批处理文件类型:Batch file 查找随机代码并导出它们,batch-file,Batch File,我在做一个谜型的 我需要找到随机代码(字符可以重复)并将其导出到.txt文件 下面是我的代码,批处理文件类型: @echo off call :scramble a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 goto :output :scramble set "scrambled%random%=%1" shift if not "%~1"=="" goto :scramble for /f "to
@echo off
call :scramble a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9
goto :output
:scramble
set "scrambled%random%=%1"
shift
if not "%~1"=="" goto :scramble
for /f "tokens=1,* delims==" %%a in ('set scrambled') do set /p "=%%b "<nul
:output
echo "Still In Development, please contact the Admin on 0405789077.">>
enigmacodes.txt
pause
@echo关闭
呼叫:扰码a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9
后藤:输出
:扰码
设置“加扰的%random%=%1”
转移
如果不是“%~1”==”转到:加扰
对于/f“tokens=1,*delims==”%%a in('set-scrambled')do-set/p“=%%b”>
enigmacodes.txt
暂停
欢迎进一步询问,欢迎提出建议 不使用
set/p
输出到不带cr/lf的屏幕,放入变量并将变量回显到输出文件中 您还需要初始化加扰变量。
您应该防止运行代码流到子例程,
因为批次本身不会将其分离 将sub重新排列到末端可保存一个标签和goto
:: Q:\Test\2018\07\31\SO_51609078.cmd
@echo off & setlocal
:: initialize var scrambled
for /f "delims==" %%a in ('set scrambled 2^>Nul') do set "%%a="
call :scramble a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9
echo "Still In Development, please contact the Admin on 0405789077."
Echo=%scrambled%
>> enigmacodes.txt Echo=%scrambled%
pause
Goto :Eof
:scramble
set "scrambled[%random%]=%1"
shift
if not "%~1"=="" goto :scramble
for /f "tokens=1,* delims==" %%a in ('set scrambled[') do call set "scrambled=%%scrambled%% %%b"
Set scrambled=%scrambled:~1%
嗨,库珀,到目前为止你试过什么?另外,请参考这一点,因为您的问题似乎不是一个有效的问题-StackOverFlow是一个问答论坛,您可以在这里就您遇到问题的特定代码片段提问,有人会建议更改代码来回答您的问题。如果你想让别人看一下你的代码,你就把它贴在上面