首页脚本VBScript 输出中的对齐实现方法

VBScript 输出中的对齐实现方法

时间2024-02-11 16:05:02发布访客分类脚本浏览317
导读:收集整理的这篇文章主要介绍了VBScript 输出中的对齐实现方法,觉得挺不错的,现在分享给大家,也给大家做个参考。 运行效果:代码(fOutput.vbs):复制代码 代码如下:str...
收集整理的这篇文章主要介绍了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

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: VBScript 输出中的对齐实现方法
本文地址: https://pptw.com/jishu/610016.html
VBS获取当前目录下所有文件夹名字的代码 vbs 获取当前目录文件数量的代码(不包括子文件夹中的)

游客 回复需填写必要信息