本帖最后由 pcl_test 于 2015-8-26 22:42 编辑
不是很严谨的一种方法- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /b *.jpg') do (
- set "fn=%%~na"
- set /a a=!random!%%900+100,b=!random!%%900+100,n+=1
- set "#!a!!b!ж!fn!=%%a"
- if "!fn:~,1!" equ "Ω" set/a m+=1
- )
- for /f "tokens=2* delims=ж=" %%i in ('set #') do (
- set "fn=%%j"
- set /a t+=1
- if "!n!" equ "!m!" (
- ren "%%j" "Ω!t!-!fn:*-=!"
- ) else ren "%%j" "Ω!t!-%%j"
- )
- pause
复制代码
bat+js,保存为bat文件运行- 1>1/* :
- @echo off
- dir /b *.jpg|cscript -nologo -e:jscript "%~f0"
- pause & exit/b
- */
-
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var arr = WScript.StdIn.ReadAll().split(/\r?\n/);
- arr.sort(function(){return Math.random()>0.5?-1:1;});
- for(var i=0;i<arr.length;i++){
- var j=i+1
- if (arr[i].substr(0, 1)!='ж'){
- fso.MoveFile(arr[i],'ж'+j+'-'+arr[i]);
- } else fso.MoveFile(arr[i],'ж'+j+'-'+arr[i].replace(/^[^\-]+-/,''));
- }
复制代码
|