[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. $d="abc.csv"
  2. $a=type $d
  3. $b=4
  4. [int]$c=$a.count/$b
  5. for($i=1;$i -lt $a.count;$i+=$c){
  6. sc ("{0}-{1:d3}.txt" -f $d,$f++) ($a[0],$a[$i..($i+$c-1)])
  7. }
复制代码
1

评分人数

TOP

回复 7# 5i365

what-if这个问题不会呀
  1. $d="abc.csv"
  2. $a=type $d
  3. $b=4
  4. [int]$c=$a.count/$b
  5. for($i=1;$i -lt $a.count;$i+=$c){
  6. sc ("{0}-{1:d3}.{2}" -f ($d -replace '^(.*)\..*','$1'),$f++,($d -replace '^.*\.(.*)$','$1')) ($a[0],$a[$i..($i+$c-1)])
  7. }
复制代码

TOP

回复 16# 5i365
  1. #@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
  2. $d="abc.csv"
  3. $a=type $d
  4. $b=2
  5. [int]$c=$a.count/$b
  6. for($i=1;$i -lt $a.count;$i+=$c){
  7. sc ("{0}-{1}.csv" -f ($a[$i] -replace '^(\d+),.*','$1'),($a[$i..($i+$c-1)][-1] -replace '^(\d+),.*','$1')) ($a[0],$a[$i..($i+$c-1)])
  8. }
复制代码
1

评分人数

TOP

回复 18# 5i365


很好懂呀,第7行只有3个知识点
格式字符串,正则,数组

TOP

返回列表