杰网资源 Design By www.escxy.com
运行效果:

VBScript 输出中的对齐实现方法

代码(fOutput.vbs):

复制代码 代码如下:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_NetworkAdapterConfiguration",,48)
For Each objItem in colItems
    Wscript.Echo objItem.Caption & fOutput(objItem.Caption) & "textinfo"
Next

Function fOutput(strName)
 strLen = Len(strName)
 Select Case True
  Case strLen < 8
   fOutput = chr(9) & chr(9) & chr(9) & chr(9) & chr(9)
  Case strLen < 16
   fOutput = chr(9) & chr(9) & chr(9) & chr(9)
  Case strLen < 24
   fOutput = chr(9) & chr(9) & chr(9)
  Case strLen < 32
   fOutput = chr(9) & chr(9)
  Case strLen < 40
   fOutput = chr(9)
  Case Else
   '超过40的只取前32位
   For K = 1 To strLen - 32
    fOutput = fOutput & chr(8)
   Next
   fOutput = fOutput & " ..." & chr(9)
  End Select
End Function


原文:https://www.enun.net/?p=2381

标签:
vbs,输出,对齐

杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com