zoukankan      html  css  js  c++  java
  • QTP的那些事VBS获得本地连接的IP地址

    代码如下:

    Set WshShell = CreateObject("WScript.Shell")
    Set oExec = WshShell.Exec("ipconfig.exe")
    Set oStdOut = oExec.StdOut
    ip = ""
    Do Until oStdOut.AtEndOfStream
        strLine = oStdOut.ReadLine
        If InStr(strLine, "本地连接") > 0 Then
            strLine = oStdOut.ReadLine
            strLine = oStdOut.ReadLine
            strLine = oStdOut.ReadLine
            ip = Mid(strLine, InStr(strLine, ":") + 2)
            Exit Do
        End If
    Loop
    
    If ip = "" Then
        MsgBox "获取本地连接IP地址失败!", vbExclamation, "错误"
    Else
        MsgBox ip, vbExclamation, ip
    End If

    作者:高级测试开发网
    博客地址:https://seniortesting.club
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    VB 程序参考
    VB6(控件):标准控件的使用详述(上)
    windows环境,python打包窗口程序
    python 中的struct
    C使用zeromq完成有意义的通讯
    svn 小白操作
    小白使用开源共享库 (C使用zeromq)
    centos安装zeromq(0mq, ZeroMQ, ØMQ)
    windows环境,python打包命令行程序
    SQL 记点
  • 原文地址:https://www.cnblogs.com/seniortestingdev/p/2354844.html
Copyright © 2011-2022 走看看