![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-07 13:37 |
共 48,040 主题排行 / 350,125 发帖 / 今日 0 篇 / 48,252 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 批量随机重命名与反重命名 |
| 可打印版本 3,576 / 54 |
| 第46楼 gundam72 | 发表于 2008-02-10 20:52 |
| 初级用户 发帖 19 积分 40 | |
|
是这样的,网易放出这样的话说,网易旗下的163相册将永久保存用户上传的图片,每张图片限制为10mb
于是有人就想办法将大文件分割成很多小的文件再伪装成图片格式上传到163相册进行永久保存,一般这种方式得到的伪图都是按一定的顺序命名的 因为这种方法得到了广泛的流转,以这种方式上传大文件到163的人多了,网易的服务器可能有点承担不了,所以网易现在开始封杀这类命名太规律化的图片 可是网易的服务器真的是很强悍,对国内所有的网络都能很好的支持,所以我就在想通过随机命名来避免网易的封杀,只要网易不按流量封杀,现在这种随机命名方式应该可以避免网易的封杀了 |
|
| 第47楼 gundam72 | 发表于 2008-02-10 20:57 |
| 初级用户 发帖 19 积分 40 | |
|
pinghu兄,你最新给的那个代码无法命名,一运行就没了
|
|
| 第48楼 gundam72 | 发表于 2008-02-10 20:58 |
| 初级用户 发帖 19 积分 40 | |
|
如果位数随机也比较好实现的话,请pinghu兄也帮我实现一下吧
|
|
| 第49楼 pinghu | 发表于 2008-02-10 21:19 |
| 中级用户 发帖 130 积分 307 | |
|
我又做了一个随机位数的 @echo off
setlocal enabledelayedexpansion call :%* 2>nul || goto choice goto :eof :choice set /p aa=安装右键菜单A,卸载右键菜单X: if %aa%==a goto :install if %aa%==x (goto :uninstall)else goto :choice goto :eof :resume cd /d "%~1" if not exist 重命名列表.txt (echo 这个文件夹里没有“重命名列表.txt”,无法恢复&pause&goto :eof) del 临时.txt 2>nul for /F "tokens=1* delims=:" %%i in ('findstr /n .* 重命名列表.txt') do set "line=%%i" &set "num%%i=%%j" for /L %%i in (!line!,-1,1) do (>> 临时.txt echo.!num%%i!) for /f "tokens=1,2 delims=^|" %%c in (临时.txt) do (ren %%d %%c) del 临时.txt goto :eof :renam cd /d "%~1" if not exist 重命名列表.txt goto :next if exist 重命名列表.txt set /p cc=当前文件夹下已存在一个重命名列表,再次重命名会导致原始文件名列表的丢失,如要继续请按A: if /i %cc%==a (goto :next) else goto :eof :next del 重命名列表.txt set /p mm=请输入随机字母位数的上限值: for %%b in (*.*) do ( if "%%~nxb"=="重命名列表.txt" goto :eof call :ranwd2 ren %%~nxb !filename!%%~xb echo %%~nxb^|!filename!%%~xb >>重命名列表.txt ) goto :eof :ranwd2 set word= set /a nn=%random%%%%mm%+1 for /l %%a in (1,1,%nn%) do (call :ranwd1) if not exist %word%.* (set filename=%word%) else call :ranwd2 goto :eof :ranwd1 call :ranltr set word=%word%%letter% goto :eof :ranltr set letter=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ set /a num=%random%%%62 call set letter=!letter:~%num%,1! goto :eof :install reg add "hkcr\directory\shell\文件夹内文件随机字母重命名\command" /f /t reg_sz /v "" /d "\"%~0\" renam \"%%1\"" reg add "hkcr\directory\shell\反重命名\command" /f /t reg_sz /v "" /d "\"%~0\" resume \"%%1\"" goto :eof :uninstall reg delete "hkcr\directory\shell\反重命名" /f reg delete "hkcr\directory\shell\文件夹内文件随机字母重命名" /f goto :eof 上个版本有个bug: ,如果源文件夹中没有重命名列表.txt文件,直接退出 现在已修复 |
|
| 第50楼 gundam72 | 发表于 2008-02-10 21:30 |
| 初级用户 发帖 19 积分 40 | |
|
这个版本很好用,虽然说了很多遍了,不过还是要感谢pinghu兄这2天对我的帮助,辛苦了
|
|
| 第51楼 pinghu | 发表于 2008-02-10 21:51 |
| 中级用户 发帖 130 积分 307 | |
|
只要楼主满意我比什么都高兴,我在写程序的过程中也学到了不少东西,不懂的时候我还发帖提问,比如:不知道你注意没有,今天我发帖子求一个文本逐行倒序的批处理,主要是要解决一次恢复的问题,如果那个帖子我没得到答案的话,这个批处理就不会成功!是terse兄给了我很大的帮助,我在这里要感谢terse!!
|
|
| 第52楼 pinghu | 发表于 2008-02-11 12:01 |
| 中级用户 发帖 130 积分 307 | |
|
这次更新精简了代码,提高了运算速度 @echo off
setlocal enabledelayedexpansion call :%* 2>nul || goto choice goto :eof :choice set /p aa=安装右键菜单A,卸载右键菜单X: if %aa%==a goto :install if %aa%==x (goto :uninstall)else goto :choice goto :eof :resume cd /d "%~1" if not exist 重命名列表.txt (echo 这个文件夹里没有“重命名列表 .txt”,无法恢复&pause&goto :eof) del 临时.txt 2>nul for /F "tokens=1* delims=:" %%i in ('findstr /n .* 重命名列 表.txt') do set "line=%%i" &set "num%%i=%%j" for /L %%i in (!line!,-1,1) do (>> 临时.txt echo.!num%%i!) for /f "tokens=1,2 delims=^|" %%c in (临时.txt) do (ren %%d % %c) del 临时.txt goto :eof :renam cd /d "%~1" if not exist 重命名列表.txt goto :next if exist 重命名列表.txt set /p aa=当前文件夹下已存在一个重命名 列表,再次重命名会导致原始文件名列表的丢失,如要继续请按A,如要 退出请按任意键: if /i %aa%==a (goto :next) else goto :eof :next del 重命名列表.txt set /p mm=请输入随机字母位数的上限值: for %%b in (*.*) do ( if "%%~nxb"=="重命名列表.txt" goto :eof call :ranwrd if not exist %word%.* call :ranwrd ren %%~nxb !word!%%~xb echo %%~nxb^|!word!%%~xb >>重命名列表.txt ) goto :eof :ranwrd set word= set /a nn=%random%%%%mm%+1 for /l %%a in (1,1,%nn%) do (call :ranltr) goto :eof :ranltr set letter=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS TUVWXYZ set /a num=%random%%%62 call set letter=!letter:~%num%,1! set word=%word%%letter% goto :eof :install reg add "hkcr\directory\shell\文件夹内文件随机字母重命名 \command" /f /t reg_sz /v "" /d "\"%~0\" renam \"%%1\"" reg add "hkcr\directory\shell\反重命名\command" /f /t reg_sz /v "" /d "\"%~0\" resume \"%%1\"" goto :eof :uninstall reg delete "hkcr\directory\shell\反重命名" /f reg delete "hkcr\directory\shell\文件夹内文件随机字母重命 名" /f goto :eof |
|
| 第53楼 pinghu | 发表于 2008-02-11 12:58 |
| 中级用户 发帖 130 积分 307 | |
|
加入了上限数字校验 @echo off
setlocal enabledelayedexpansion color 0a call :%* 2>nul || goto choice goto :eof :choice set /p aa=安装右键菜单A,卸载右键菜单X: if %aa%==a goto :install if %aa%==x (goto :uninstall)else goto :choice goto :eof :resume cd /d "%~1" if not exist 重命名列表.txt (echo 这个文件夹里没有“重命名列表.txt”,无法恢复&pause&goto :eof) del 临时.txt 2>nul for /F "tokens=1* delims=:" %%i in ('findstr /n .* 重命名列表.txt') do set "line=%%i" &set "num%%i=%%j" for /L %%i in (!line!,-1,1) do (>> 临时.txt echo.!num%%i!) for /f "tokens=1,2 delims=^|" %%c in (临时.txt) do (ren %%d %%c) del 临时.txt goto :eof :renam cd /d "%~1" if not exist 重命名列表.txt goto :next if exist 重命名列表.txt set /p aa=当前文件夹下已存在一个重命名列表,再次重命名会导致原始文件名列表的丢失,如要继续请按A,如要退出请按任意键: if /i %aa%==a (goto :next) else goto :eof :next del 重命名列表.txt :rector set /p mm=请输入随机字母位数的上限值: echo %mm%|findstr "^[0-9]*$">nul || echo 上限值不能包含字符:&&goto :rector if %mm% equ 0 echo 上限值不能为零&&goto :rector for %%b in (*.*) do ( if "%%~nxb"=="重命名列表.txt" goto :eof call :ranwrd if not exist %word%.* call :ranwrd ren %%~nxb !word!%%~xb echo %%~nxb^|!word!%%~xb >>重命名列表.txt ) goto :eof :ranwrd set word= set /a nn=%random%%%%mm%+1 for /l %%a in (1,1,%nn%) do (call :ranltr) goto :eof :ranltr set letter=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ set /a num=%random%%%62 call set word=%word%%%letter:~%num%,1%% goto :eof :install reg add "hkcr\directory\shell\文件夹内文件随机字母重命名\command" /f /t reg_sz /v "" /d "\"%~0\" renam \"%%1\"" reg add "hkcr\directory\shell\反重命名\command" /f /t reg_sz /v "" /d "\"%~0\" resume \"%%1\"" goto :eof :uninstall reg delete "hkcr\directory\shell\反重命名" /f reg delete "hkcr\directory\shell\文件夹内文件随机字母重命名" /f goto :eof |
|
| 第54楼 gundam72 | 发表于 2008-02-11 13:17 |
| 初级用户 发帖 19 积分 40 | |
|
最新的字体颜色我很喜欢,上限数字校验是隐含操作,用户不可见的么?
速度有了提高~ |
|
| 第55楼 pinghu | 发表于 2008-02-11 15:35 |
| 中级用户 发帖 130 积分 307 | |
|
当你把字符输入是会提示不能输入字符,当你输入0时提示你上限不能为0,输入正确时则不提示!!
|
|
| 上一页 1 2 3 4 |
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |