找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 23598|回复: 7

[文本处理] [已解决]批处理怎么随机提取的字母啊?

[复制链接]
发表于 2013-4-20 18:51:35 | 显示全部楼层 |阅读模式
  1. @echo off&setlocal enabledelayedexpansion
  2. for %%i in (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) do (
  3.     set /a n+=1,a=!random!%%2
  4.     if !a! equ 0 (
  5.       set "_!random!!random!!random!=!n!"
  6.       ) else (
  7.       set "_!random!!random!!random!=%%i"
  8.    )
  9. )
  10. for /f "tokens=2 delims==" %%i in ('set _') do (
  11.     set /a n-=1
  12.     if !n! equ 15 pause>nul&goto :eof
  13.     pause  
  14.     set /p=%%i <nul
  15. )
复制代码
请问这里or里面的字母是怎么随机提出来的啊?还有set “_!random!!random!!random!=%%i"是怎么回事啊???

评分

参与人数 1PB +2 收起 理由
Batcher + 2 感谢给帖子标题标注[已解决]字样

查看全部评分

 楼主| 发表于 2013-4-21 12:34:31 | 显示全部楼层
没人知道么??怎么没人理我啊?
发表于 2013-4-22 18:20:03 | 显示全部楼层
请问这里or里面的字母是怎么随机提出来的啊?

请问哪里有一个or?
发表于 2013-4-22 18:21:58 | 显示全部楼层
还有set “_!random!!random!!random!=%%i"是怎么回事啊???

给一个变量赋值
变量的值是%%i
变量的名字是由一个下划线和三个随机数组成的字符串
 楼主| 发表于 2013-4-24 13:29:06 | 显示全部楼层
回复 4# BAT-VBS

然后怎么把字母搞出来呢??
还有,下面的for里面的 ‘_set’怎么理解呢???望大神指点
 楼主| 发表于 2013-4-24 13:29:36 | 显示全部楼层
回复  BAT-VBS

然后怎么把字母搞出来呢??
还有,下面的for里面的 ‘_set’怎么理解呢???望大神指 ...
林小七 发表于 2013-4-24 13:29



打错了,不好意识,是set_
发表于 2013-4-24 16:30:07 | 显示全部楼层
回复 6# 林小七


看看帮助:
SET command invoked with just a variable name, no equal sign or value
will display the value of all variables whose prefix matches the name
given to the SET command.  For example:

    SET P

would display all variables that begin with the letter 'P'

做个实验:
set _a=1
set _b=2
set _c=3
set _

评分

参与人数 1技术 +1 收起 理由
Batcher + 1 乐于助人

查看全部评分

 楼主| 发表于 2013-4-24 23:06:38 | 显示全部楼层
回复 7# BAT-VBS


    懂了,谢谢啊,原来是一个临时的变量的集合.......学习了,以前知道在cmd里输入set m就输出m开头的环境变量,没想到还能这么用,高手啊,学无止境啊,还要努力啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-20 05:54 , Processed in 0.021787 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表