[Fortran] 纯文本查看 复制代码
c subroutine machostnm
USE MSFLIB
LOGICAL(4) result
character sult(17)
c write(*,*) ' '
write(*,'(1x,a16\)') ' 正在验证用户... '
result = SYSTEMQQ('ipconfig /all >ipconfig.txt')
result = SYSTEMQQ('find "Physical Address" ipconfig.txt >
&massage.txt')
result = SYSTEMQQ('for /f "skip=1 tokens=2 delims=:" %a in
& (massage.txt) do @echo %a>a.txt')
result = SYSTEMQQ('for /f "tokens=* delims=- " %a in (a.txt)
& do @echo %a>mac地址.txt')
result = SYSTEMQQ('find "Host Name" ipconfig.txt >
&massage.txt')
result = SYSTEMQQ('for /f "skip=1 tokens=2 delims=:" %a in
& (massage.txt) do @echo %a>a.txt')
result = SYSTEMQQ('for /f "tokens=* delims=- " %a in (a.txt)
& do @echo %a>host用户名.txt')
result = SYSTEMQQ('del ipconfig.txt')
result = SYSTEMQQ('del massage.txt')
result = SYSTEMQQ('del a.txt')
! 物理网卡地址在 mac地址.txt 文件中
open(12,file='mac地址.txt')
read(12,'(17a1)') (sult(i),i=1,17)
close(12,status='delete')
write(111,*) sult
c write(*,'(A28,17a1\)') 'mac地址:',(sult(i),i=1,17)
open(12,file='host用户名.txt')
read(12,'(17a1)',err=123) (sult(i),i=1,17)
close(12,status='delete')
123 write(*,'(1x,A12,17a1\)') ' 用户名:',(sult(i),i=1,17)
return
end