Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enumerate hard disks, exclude partitions
#27
this will work for the text file(china cmd info.txt) at least on my pc it does. 

Code:
Copy      Help
str s.getfile("$desktop$\china cmd info.txt")
s.trim
s.ConvertEncoding(936 _unicode)
;out s
int i tt ttt tttt tset
str disklist partitionlist1 partitionlist2
ARRAY(str) a=s
for(i a.len-1 -1 -1)
,if a[i].len = 0
,,a.remove(i)
for i 0 a.len
,a[i].trim
,if(findrx(a[i] "磁盘(?=\s\d*\s+联机)" 0 0) >=0)
,,if ttt=0
,,,disklist+ a[i]
,,,ttt+1
,,else
,,,disklist+"[]"
,,,disklist+ a[i]
,,,ttt+1
,if(a[i]="磁盘 0 现在是所选磁盘。")
,,tset=!tset
,if(a[i]="磁盘 1 现在是所选磁盘。")
,,tset=!tset
,if tset
,,if(findrx(a[i] "分区(?=\s+\d+)" 0 0)>=0)
,,,if tt=0
,,,,partitionlist1+ a[i]
,,,,tt+1
,,,else
,,,,partitionlist1 + "[]"
,,,,partitionlist1 +a[i]
,,,,tt+1
,else
,,if(findrx(a[i] "分区(?=\s+\d+)" 0 0)>=0)
,,,if tttt=0
,,,,partitionlist2+ a[i]
,,,,tttt+1
,,,else
,,,,partitionlist2 + "[]"
,,,,partitionlist2 +a[i]
,,,,tttt+1
int disknum= numlines(disklist)
int part1num= numlines(partitionlist1)
int part2num= numlines(partitionlist2)
out disknum
out part1num
out part2num

I don't know if it will work for results from RunConsole2

need to see what the output looks like.
after line 4 in original function
Code:
Copy      Help
s.trim

add new line

Code:
Copy      Help
out s
 and copy output and paste here so can see what coding string s is in


Messages In This Thread
Enumerate hard disks, exclude partitions - by win - 09-08-2018, 09:34 PM
RE: Enumerate hard disks, exclude partitions - by Kevin - 09-09-2018, 08:16 PM

Forum Jump:


Users browsing this thread: 8 Guest(s)