[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
猜测是把数字当着字符串比较了,
(91 -ge 201) -and (91 -le 210)
91 -ge 201 为 true,但 91 -le 210 为 false
试试 if((1*$file_id -ge $start) -and (1*$file_id -le $end) )

TOP

这样应该也可以
  1. $Path = "D:\000\"
  2. $step=10 #50000
  3. $total=100 #600000
  4. for($i=0; $i -lt $total; $i++) {
  5.   $start = [Math]::floor($i/$step)*$step + 1;
  6.   $end = [Math]::floor($i/$step+1)*$step;
  7.   $path_mkdir = $Path + $start + "-" + $end;
  8.           $file = $path + ($i + 1) + '.txt';
  9.           if( !(Test-Path $path_mkdir) ){
  10.               mkdir $path_mkdir;
  11.           }
  12.           if( Test-Path $file ){
  13.               mv -force $file ($path_mkdir + '\');
  14.           }
  15. }
复制代码

TOP

返回列表